Commit 43fa7394 authored by Dan Carpenter's avatar Dan Carpenter Committed by Jonathan Cameron

iio: core: Fix an error pointer vs NULL bug in devm_iio_device_alloc()

The devm_iio_device_alloc() function is supposed to return NULL and not
error pointers.  Returning an error pointer will lead to a crash in the
callers.

Fixes: cf5724e9 ("iio: core: simplify some devm functions")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarAlexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/YJ+a1yaMu2QNATgt@mwandaSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 2a1c6a77
......@@ -1711,7 +1711,7 @@ struct iio_dev *devm_iio_device_alloc(struct device *parent, int sizeof_priv)
ret = devm_add_action_or_reset(parent, devm_iio_device_release,
iio_dev);
if (ret)
return ERR_PTR(ret);
return NULL;
return iio_dev;
}
......
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