Commit f91f9ece authored by Erick Archer's avatar Erick Archer Committed by Jonathan Cameron

iio: event: use sizeof(*pointer) instead of sizeof(type)

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: default avatarErick Archer <erick.archer@outlook.com>
Link: https://lore.kernel.org/r/AS8PR02MB7237D024459C314CECE72EAF8BFE2@AS8PR02MB7237.eurprd02.prod.outlook.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent f451fbd7
...@@ -581,8 +581,8 @@ int iio_device_register_eventset(struct iio_dev *indio_dev) ...@@ -581,8 +581,8 @@ int iio_device_register_eventset(struct iio_dev *indio_dev)
iio_check_for_dynamic_events(indio_dev))) iio_check_for_dynamic_events(indio_dev)))
return 0; return 0;
ev_int = kzalloc(sizeof(struct iio_event_interface), GFP_KERNEL); ev_int = kzalloc(sizeof(*ev_int), GFP_KERNEL);
if (ev_int == NULL) if (!ev_int)
return -ENOMEM; return -ENOMEM;
iio_dev_opaque->event_interface = ev_int; iio_dev_opaque->event_interface = ev_int;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment