linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ACPI: remove useless comparisons in acpi_pci_link_check_possible(), acpi_pci_link_check_current()
@ 2022-07-19  9:59 Andrey Strachuk
  2022-07-19 20:46 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Andrey Strachuk @ 2022-07-19  9:59 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Andrey Strachuk, Rafael J. Wysocki, Len Brown, linux-pci,
	linux-acpi, linux-kernel, ldv-project

Local variable 'p' is initialized by an address
of field of acpi_resource, so it does not make
sense to compare 'p' with NULL.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Andrey Strachuk <strochuk@ispras.ru>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
---
 drivers/acpi/pci_link.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index 58647051c948..aa1038b8aec4 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -95,7 +95,7 @@ static acpi_status acpi_pci_link_check_possible(struct acpi_resource *resource,
 	case ACPI_RESOURCE_TYPE_IRQ:
 		{
 			struct acpi_resource_irq *p = &resource->data.irq;
-			if (!p || !p->interrupt_count) {
+			if (!p->interrupt_count) {
 				acpi_handle_debug(handle,
 						  "Blank _PRS IRQ resource\n");
 				return AE_OK;
@@ -121,7 +121,7 @@ static acpi_status acpi_pci_link_check_possible(struct acpi_resource *resource,
 		{
 			struct acpi_resource_extended_irq *p =
 			    &resource->data.extended_irq;
-			if (!p || !p->interrupt_count) {
+			if (!p->interrupt_count) {
 				acpi_handle_debug(handle,
 						  "Blank _PRS EXT IRQ resource\n");
 				return AE_OK;
@@ -182,7 +182,7 @@ static acpi_status acpi_pci_link_check_current(struct acpi_resource *resource,
 	case ACPI_RESOURCE_TYPE_IRQ:
 		{
 			struct acpi_resource_irq *p = &resource->data.irq;
-			if (!p || !p->interrupt_count) {
+			if (!p->interrupt_count) {
 				/*
 				 * IRQ descriptors may have no IRQ# bits set,
 				 * particularly those w/ _STA disabled
@@ -197,7 +197,7 @@ static acpi_status acpi_pci_link_check_current(struct acpi_resource *resource,
 		{
 			struct acpi_resource_extended_irq *p =
 			    &resource->data.extended_irq;
-			if (!p || !p->interrupt_count) {
+			if (!p->interrupt_count) {
 				/*
 				 * extended IRQ descriptors must
 				 * return at least 1 IRQ
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ACPI: remove useless comparisons in acpi_pci_link_check_possible(), acpi_pci_link_check_current()
  2022-07-19  9:59 [PATCH] ACPI: remove useless comparisons in acpi_pci_link_check_possible(), acpi_pci_link_check_current() Andrey Strachuk
@ 2022-07-19 20:46 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2022-07-19 20:46 UTC (permalink / raw)
  To: Andrey Strachuk
  Cc: Bjorn Helgaas, Rafael J. Wysocki, Len Brown, linux-pci,
	linux-acpi, linux-kernel, ldv-project

Since this only affects pci_link.c, I would update the subject to
match the style of previous commits:

  ACPI/PCI: Remove useless NULL pointer checks

On Tue, Jul 19, 2022 at 12:59:50PM +0300, Andrey Strachuk wrote:
> Local variable 'p' is initialized by an address
> of field of acpi_resource, so it does not make
> sense to compare 'p' with NULL.

Rewrap to fill 75 columns, which is the typical width of commit logs.

> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Andrey Strachuk <strochuk@ispras.ru>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")

I think you should drop this Fixes: tag because it's not useful.

Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>

> ---
>  drivers/acpi/pci_link.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
> index 58647051c948..aa1038b8aec4 100644
> --- a/drivers/acpi/pci_link.c
> +++ b/drivers/acpi/pci_link.c
> @@ -95,7 +95,7 @@ static acpi_status acpi_pci_link_check_possible(struct acpi_resource *resource,
>  	case ACPI_RESOURCE_TYPE_IRQ:
>  		{
>  			struct acpi_resource_irq *p = &resource->data.irq;
> -			if (!p || !p->interrupt_count) {
> +			if (!p->interrupt_count) {
>  				acpi_handle_debug(handle,
>  						  "Blank _PRS IRQ resource\n");
>  				return AE_OK;
> @@ -121,7 +121,7 @@ static acpi_status acpi_pci_link_check_possible(struct acpi_resource *resource,
>  		{
>  			struct acpi_resource_extended_irq *p =
>  			    &resource->data.extended_irq;
> -			if (!p || !p->interrupt_count) {
> +			if (!p->interrupt_count) {
>  				acpi_handle_debug(handle,
>  						  "Blank _PRS EXT IRQ resource\n");
>  				return AE_OK;
> @@ -182,7 +182,7 @@ static acpi_status acpi_pci_link_check_current(struct acpi_resource *resource,
>  	case ACPI_RESOURCE_TYPE_IRQ:
>  		{
>  			struct acpi_resource_irq *p = &resource->data.irq;
> -			if (!p || !p->interrupt_count) {
> +			if (!p->interrupt_count) {
>  				/*
>  				 * IRQ descriptors may have no IRQ# bits set,
>  				 * particularly those w/ _STA disabled
> @@ -197,7 +197,7 @@ static acpi_status acpi_pci_link_check_current(struct acpi_resource *resource,
>  		{
>  			struct acpi_resource_extended_irq *p =
>  			    &resource->data.extended_irq;
> -			if (!p || !p->interrupt_count) {
> +			if (!p->interrupt_count) {
>  				/*
>  				 * extended IRQ descriptors must
>  				 * return at least 1 IRQ
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-19 20:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-19  9:59 [PATCH] ACPI: remove useless comparisons in acpi_pci_link_check_possible(), acpi_pci_link_check_current() Andrey Strachuk
2022-07-19 20:46 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).