Skip to contentSkip to conversation

hpet: remove useless check if fixmem32 is NULL

char-misc-next New Tomas Winkler 2 participants 2 messages Sep 4, 2013 – Sep 29, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

fixmem32 is assigned to address of res->data member so the address is always valid

Actually since we are not checking for res != NULL static analyzing is complaining about referencing the pointer and consequent check for null.
The code snippet looks confusing also for human eyes.

---
 drivers/char/hpet.c | 2 --
 1 file changed, 2 deletions(-)
drivers/char/hpet.c +0 -2
index 448ce5e..c8f4329 100644
@@ -971,8 +971,6 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data)
 		struct acpi_resource_fixed_memory32 *fixmem32;
 
 		fixmem32 = &res->data.fixed_memory32;
-		if (!fixmem32)
-			return AE_NO_MEMORY;
 
 		hdp->hd_phys_address = fixmem32->address;
 		hdp->hd_address = ioremap(fixmem32->address,
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw

PATCH 1/1 hpet: remove useless check if fixmem32 is NULL

From: Tomas Winkler <[email protected]>

fixmem32 is assigned to address of res->data member so the address is always valid

Actually since we are not checking for res != NULL static analyzing is complaining about referencing the pointer and consequent check for null.
The code snippet looks confusing also for human eyes.

---
 drivers/char/hpet.c |    2 --
 1 file changed, 2 deletions(-)
drivers/char/hpet.c +0 -2
index ab8651d..d6568a6 100644
@@ -971,8 +971,6 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data)
 		struct acpi_resource_fixed_memory32 *fixmem32;
 
 		fixmem32 = &res->data.fixed_memory32;
-		if (!fixmem32)
-			return AE_NO_MEMORY;
 
 		hdp->hd_phys_address = fixmem32->address;
 		hdp->hd_address = ioremap(fixmem32->address,