]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
iio: event: use sizeof(*pointer) instead of sizeof(type)
authorErick Archer <erick.archer@outlook.com>
Sun, 2 Jun 2024 17:23:54 +0000 (19:23 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Thu, 13 Jun 2024 18:19:23 +0000 (19:19 +0100)
It is preferred to use sizeof(*pointer) instead of sizeof(type)
due to the type of the variable can change and one needs not
change the former (unlike the latter). At the same time refactor
the NULL comparison.

This patch has no effect on runtime behavior.

Signed-off-by: Erick Archer <erick.archer@outlook.com>
Link: https://lore.kernel.org/r/AS8PR02MB7237D024459C314CECE72EAF8BFE2@AS8PR02MB7237.eurprd02.prod.outlook.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/industrialio-event.c

index a64f8fbac597ea012b690854cc8bbe6dd6c30cf5..db06501b0e61a91e3b06345b418504803f4aefb5 100644 (file)
@@ -581,8 +581,8 @@ int iio_device_register_eventset(struct iio_dev *indio_dev)
              iio_check_for_dynamic_events(indio_dev)))
                return 0;
 
-       ev_int = kzalloc(sizeof(struct iio_event_interface), GFP_KERNEL);
-       if (ev_int == NULL)
+       ev_int = kzalloc(sizeof(*ev_int), GFP_KERNEL);
+       if (!ev_int)
                return -ENOMEM;
 
        iio_dev_opaque->event_interface = ev_int;