This is a note to let you know that I've just added the patch titled iio: inkern: fix return value in devm_of_iio_channel_get_by_name() to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: iio-inkern-fix-return-value-in-devm_of_iio_channel_g.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit ceddde54b5eb9f4013584b0f97f6b8dc3fa6020b Author: Nuno Sá <nuno.sa@xxxxxxxxxx> Date: Fri Jul 15 14:28:50 2022 +0200 iio: inkern: fix return value in devm_of_iio_channel_get_by_name() [ Upstream commit 9e878dbc0e8322f8b2f5ab0093c1e89926362dbe ] of_iio_channel_get_by_name() can either return NULL or an error pointer so that only doing IS_ERR() is not enough. Fix it by checking the NULL pointer case and return -ENODEV in that case. Note this is done like this so that users of the function (which only check for error pointers) do not need to be changed. This is not ideal since we are losing error codes and as such, in a follow up change, things will be unified so that of_iio_channel_get_by_name() only returns error codes. Fixes: 6e39b145cef7 ("iio: provide of_iio_channel_get_by_name() and devm_ version it") Signed-off-by: Nuno Sá <nuno.sa@xxxxxxxxxx> Reviewed-by: Andy Shevchenko <andy.shevchenko@xxxxxxxxx> Link: https://lore.kernel.org/r/20220715122903.332535-3-nuno.sa@xxxxxxxxxx Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index 30a8ecb692f8..bf9ce01c854b 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c @@ -395,6 +395,8 @@ struct iio_channel *devm_of_iio_channel_get_by_name(struct device *dev, channel = of_iio_channel_get_by_name(np, channel_name); if (IS_ERR(channel)) return channel; + if (!channel) + return ERR_PTR(-ENODEV); ret = devm_add_action_or_reset(dev, devm_iio_channel_free, channel); if (ret)