diff mbox series

[v3] ACPI/PCI: Remove useless NULL pointer checks

Message ID 20220721141133.1431117-1-strochuk@ispras.ru (mailing list archive)
State Mainlined, archived
Headers show
Series [v3] ACPI/PCI: Remove useless NULL pointer checks | expand

Commit Message

Andrey Strachuk July 21, 2022, 2:11 p.m. UTC
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>
---
 drivers/acpi/pci_link.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Rafael J. Wysocki July 27, 2022, 7:23 p.m. UTC | #1
On Thu, Jul 21, 2022 at 4:12 PM Andrey Strachuk <strochuk@ispras.ru> 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.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Andrey Strachuk <strochuk@ispras.ru>
> ---
>  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
> --

Applied as 5.20 material with the R-by tag from Bjorn which is still
applicable AFAICS.

Thanks!
diff mbox series

Patch

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