From: Guenter Roeck <linux@roeck-us.net>
To: Ahsan Hussain <ahsan_hussain@mentor.com>
Cc: jdelvare@suse.com, linux-hwmon@vger.kernel.org,
linux-kernel@vger.kernel.org,
chombour <Cedric_Hombourger@mentor.com>,
ahsann <Noor_Ahsan@mentor.com>,
m.purski@samsung.com
Subject: Re: [PATCH 1/1] hwmon: (ina2xx) initialize mutex before locking
Date: Mon, 16 Apr 2018 10:28:58 -0700 [thread overview]
Message-ID: <20180416172858.GA9447@roeck-us.net> (raw)
In-Reply-To: <f286b0f4-948f-74a7-6dc1-90ca88f3dcdc@mentor.com>
On Mon, Apr 16, 2018 at 10:08:19PM +0500, Ahsan Hussain wrote:
>
> Upstream commit
>
> 8d008c0c ("hwmon: (ina2xx) Make calibration register value fixed")
>
This doesn't have to be on separate lines; as written, it just causes
confusion.
> makes ina2xx_set_shunt() call mutex_lock on an un-initialized mutex.
> Initialize it prior so we don't get a NULL pointer dereference error
>
> Signed-off-by: Ahsan Hussain <ahsan_hussain@mentor.com>
Good find, but your patch is corrupted to the point where any attenpt to
fix it up on my side failed. Please resend without corruption, and please
provide a Fixes: line.
Thanks,
Guenter
> ---
> drivers/hwmon/ina2xx.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c
> index a629f7c..1304f01 100644
> --- a/drivers/hwmon/ina2xx.c
> +++ b/drivers/hwmon/ina2xx.c
> @@ -457,6 +457,8 @@ static int ina2xx_probe(struct i2c_client *client,
> val = INA2XX_RSHUNT_DEFAULT;
> }
> + mutex_init(&data->config_lock);
> +
> ina2xx_set_shunt(data, val);
> ina2xx_regmap_config.max_register = data->config->registers;
> @@ -473,8 +475,6 @@ static int ina2xx_probe(struct i2c_client *client,
> return -ENODEV;
> }
> - mutex_init(&data->config_lock);
> -
> data->groups[group++] = &ina2xx_group;
> if (id->driver_data == ina226)
> data->groups[group++] = &ina226_group;
> --
> 2.7.4
>
next prev parent reply other threads:[~2018-04-16 18:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-16 17:08 [PATCH 1/1] hwmon: (ina2xx) initialize mutex before locking Ahsan Hussain
2018-04-16 17:28 ` Guenter Roeck [this message]
2018-04-16 17:48 ` Ahsan Hussain
2018-04-16 17:51 ` Guenter Roeck
-- strict thread matches above, loose matches on Subject: below --
2018-04-16 17:53 ahsan_hussain
2018-04-16 18:37 ` Guenter Roeck
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=20180416172858.GA9447@roeck-us.net \
--to=linux@roeck-us.net \
--cc=Cedric_Hombourger@mentor.com \
--cc=Noor_Ahsan@mentor.com \
--cc=ahsan_hussain@mentor.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.purski@samsung.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox