From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jonathan Cameron <jic23@kernel.org>,
Yicong Yang <yangyicong@hisilicon.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
Nuno Sa <nuno.sa@analog.com>,
Andy Shevchenko <andy.shevchenko@gmail.com>,
linux-iio@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] iio: core: Fix an error pointer vs NULL bug in devm_iio_device_alloc()
Date: Sat, 15 May 2021 12:56:39 +0300 [thread overview]
Message-ID: <YJ+a1yaMu2QNATgt@mwanda> (raw)
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: d240dc25e3b8 ("iio: core: simplify some devm functions")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/iio/industrialio-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index bfa20a346f71..75e92bac78f3 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -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;
}
--
2.30.2
next reply other threads:[~2021-05-15 9:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-15 9:56 Dan Carpenter [this message]
2021-05-16 5:30 ` [PATCH] iio: core: Fix an error pointer vs NULL bug in devm_iio_device_alloc() Alexandru Ardelean
2021-05-16 9:09 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YJ+a1yaMu2QNATgt@mwanda \
--to=dan.carpenter@oracle.com \
--cc=andy.shevchenko@gmail.com \
--cc=jic23@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=yangyicong@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.