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

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@mwanda


Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 2a1c6a77
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
}