ACPI: remove unneeded NULL pointer check
PATCH 1/1 ACPI: remove unneeded NULL pointer check
nla_data() cannot return NULL as it simply adds NLA_HDRLEN to the passed pointer. The NULL pointer check is therefore superfluous. Remove it.
Found by smatch:
drivers/acpi/event.c:130 acpi_bus_generate_netlink_event() warn: can 'event' even be NULL?
Signed-off-by Mathias Krause <[email protected]>
Cc Len Brown <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc Dan Carpenter <[email protected]>
--- drivers/acpi/event.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/acpi/event.c +0 -5
@@ -127,11 +127,6 @@ int acpi_bus_generate_netlink_event(const char *device_class, } event =nla_data (attr); -if (!event) { -nlmsg_free (skb); -return -EINVAL ; - } -memset (event,0 ,sizeof (struct acpi_genl_event ));strcpy (event->device_class, device_class);
Signature · 1 line
1.7.10.4
Rafael J. Wysocki
AppliedQuoted 11 lines · Mathias Krause
nla_data()cannot return NULL as it simply addsNLA_HDRLENto the passed pointer. The NULL pointer check is therefore superfluous. Remove it.Found by smatch:
drivers/acpi/event.c:130acpi_bus_generate_netlink_event()warn: can 'event' even be NULL?Signed-off-by Mathias Krause <[email protected]>Cc Len Brown <[email protected]>Cc "Rafael J. Wysocki" <[email protected]>Cc Dan Carpenter <[email protected]>
Applied, thanks!
Quoted 21 lines
--- drivers/acpi/event.c | 5 ----- 1 file changed, 5 deletions(-)drivers/acpi/event.c +0
-5@@ -127,11 +127,6 @@ int acpi_bus_generate_netlink_event(const char *device_class, } event =nla_data (attr); -if (!event) { -nlmsg_free (skb); -return -EINVAL ; - } -memset (event,0 ,sizeof (struct acpi_genl_event ));strcpy (event->device_class, device_class);
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.