All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Support Opensource <support.opensource@diasemi.com>,
	Adam Ward <Adam.Ward.opensource@diasemi.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] regulator: da9121: Potential Oops in da9121_assign_chip_model()
Date: Mon, 07 Dec 2020 17:55:44 +0000	[thread overview]
Message-ID: <X85soGKnWAjPUA7a@mwanda> (raw)

There is a missing "return ret;" on this error path so we call
"da9121_check_device_type(i2c, chip);" which will end up dereferencing
"chip->regmap" and lead to an Oops.

Fixes: c860476b9e3a ("regulator: da9121: Add device variant regmaps")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/regulator/da9121-regulator.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/regulator/da9121-regulator.c b/drivers/regulator/da9121-regulator.c
index db1c2cc838bc..e4fc3a7cd5d8 100644
--- a/drivers/regulator/da9121-regulator.c
+++ b/drivers/regulator/da9121-regulator.c
@@ -915,6 +915,7 @@ static int da9121_assign_chip_model(struct i2c_client *i2c,
 		ret = PTR_ERR(chip->regmap);
 		dev_err(chip->dev, "Failed to configure a register map: %d\n",
 			ret);
+		return ret;
 	}
 
 	ret = da9121_check_device_type(i2c, chip);
-- 
2.29.2

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Support Opensource <support.opensource@diasemi.com>,
	Adam Ward <Adam.Ward.opensource@diasemi.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] regulator: da9121: Potential Oops in da9121_assign_chip_model()
Date: Mon, 7 Dec 2020 20:55:44 +0300	[thread overview]
Message-ID: <X85soGKnWAjPUA7a@mwanda> (raw)

There is a missing "return ret;" on this error path so we call
"da9121_check_device_type(i2c, chip);" which will end up dereferencing
"chip->regmap" and lead to an Oops.

Fixes: c860476b9e3a ("regulator: da9121: Add device variant regmaps")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/regulator/da9121-regulator.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/regulator/da9121-regulator.c b/drivers/regulator/da9121-regulator.c
index db1c2cc838bc..e4fc3a7cd5d8 100644
--- a/drivers/regulator/da9121-regulator.c
+++ b/drivers/regulator/da9121-regulator.c
@@ -915,6 +915,7 @@ static int da9121_assign_chip_model(struct i2c_client *i2c,
 		ret = PTR_ERR(chip->regmap);
 		dev_err(chip->dev, "Failed to configure a register map: %d\n",
 			ret);
+		return ret;
 	}
 
 	ret = da9121_check_device_type(i2c, chip);
-- 
2.29.2


             reply	other threads:[~2020-12-07 17:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07 17:55 Dan Carpenter [this message]
2020-12-07 17:55 ` [PATCH] regulator: da9121: Potential Oops in da9121_assign_chip_model() Dan Carpenter
2020-12-08  9:53 ` Adam Ward
2020-12-08  9:53   ` Adam Ward
2020-12-08 17:10 ` Mark Brown

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=X85soGKnWAjPUA7a@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=Adam.Ward.opensource@diasemi.com \
    --cc=broonie@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=support.opensource@diasemi.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.