Linux IIO development
 help / color / mirror / Atom feed
* [PATCH] iio: adc: pac1921: add missing error return in probe()
@ 2024-08-08 19:28 Dan Carpenter
  2024-08-09  6:18 ` Christophe JAILLET
  2024-08-09  7:19 ` Matteo Martelli
  0 siblings, 2 replies; 12+ messages in thread
From: Dan Carpenter @ 2024-08-08 19:28 UTC (permalink / raw)
  To: Matteo Martelli
  Cc: Jonathan Cameron, Lars-Peter Clausen, linux-iio, linux-kernel,
	kernel-janitors

This error path was intended to return, and not just print an error.  The
current code will lead to an error pointer dereference.

Fixes: 371f778b83cd ("iio: adc: add support for pac1921")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/iio/adc/pac1921.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/pac1921.c b/drivers/iio/adc/pac1921.c
index d04c6685d780..8200a47bdf21 100644
--- a/drivers/iio/adc/pac1921.c
+++ b/drivers/iio/adc/pac1921.c
@@ -1168,8 +1168,8 @@ static int pac1921_probe(struct i2c_client *client)
 
 	priv->regmap = devm_regmap_init_i2c(client, &pac1921_regmap_config);
 	if (IS_ERR(priv->regmap))
-		dev_err_probe(dev, (int)PTR_ERR(priv->regmap),
-			      "Cannot initialize register map\n");
+		return dev_err_probe(dev, (int)PTR_ERR(priv->regmap),
+				     "Cannot initialize register map\n");
 
 	devm_mutex_init(dev, &priv->lock);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-09-13 19:39 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-08 19:28 [PATCH] iio: adc: pac1921: add missing error return in probe() Dan Carpenter
2024-08-09  6:18 ` Christophe JAILLET
2024-08-09  7:31   ` Matteo Martelli
2024-08-09  8:41     ` Christophe JAILLET
2024-08-09 15:51       ` Matteo Martelli
2024-08-09 17:04         ` Matteo Martelli
2024-08-09 17:27         ` Dan Carpenter
2024-08-09 15:18     ` Dan Carpenter
2024-08-10 10:35       ` Jonathan Cameron
2024-09-11  9:32         ` Matteo Martelli
2024-09-13 19:39           ` Jonathan Cameron
2024-08-09  7:19 ` Matteo Martelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox