[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1490617069-13119-13-git-send-email-peda@axentia.se>
Date: Mon, 27 Mar 2017 14:17:49 +0200
From: Peter Rosin <peda@...ntia.se>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
CC: Peter Rosin <peda@...ntia.se>, Wolfram Sang <wsa@...-dreams.de>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Jonathan Cameron <jic23@...nel.org>,
Hartmut Knaack <knaack.h@....de>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald-Stadler <pmeerw@...erw.net>,
Jonathan Corbet <corbet@....net>, <linux-i2c@...r.kernel.org>,
<devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-iio@...r.kernel.org>, <linux-doc@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Colin Ian King <colin.king@...onical.com>,
Paul Gortmaker <paul.gortmaker@...driver.com>
Subject: [PATCH v11 12/12] mux: core: fix error handling in devm_mux_chip_alloc
The error handling is mixed up. mux_chip_alloc() doesn't return an error
pointer (just NULL on failure), so check for NULL instead of using IS_ERR.
devm_mux_chip_alloc is documented to return NULL on failure, so fix that
as well.
All users of devm_mux_chip_alloc() are coded according to documentation.
Fixes: d47598cc669b ("mux: minimal mux subsystem and gpio-based mux controller")
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Peter Rosin <peda@...ntia.se>
---
drivers/mux/mux-core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/mux/mux-core.c b/drivers/mux/mux-core.c
index 900b88526f97..66a8bccfc3d7 100644
--- a/drivers/mux/mux-core.c
+++ b/drivers/mux/mux-core.c
@@ -166,12 +166,12 @@ struct mux_chip *devm_mux_chip_alloc(struct device *dev,
ptr = devres_alloc(devm_mux_chip_release, sizeof(*ptr), GFP_KERNEL);
if (!ptr)
- return ERR_PTR(-ENOMEM);
+ return NULL;
mux_chip = mux_chip_alloc(dev, controllers, sizeof_priv);
- if (IS_ERR(mux_chip)) {
+ if (!mux_chip) {
devres_free(ptr);
- return mux_chip;
+ return NULL;
}
*ptr = mux_chip;
--
2.1.4
Powered by blists - more mailing lists