LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] regulator: ab8500: tidy ab8500_regulator_get_mode()
@ 2018-04-19 10:08 Dan Carpenter
  2018-04-20  8:12 ` Lee Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-04-19 10:08 UTC (permalink / raw)
  To: Liam Girdwood, Lee Jones; +Cc: Mark Brown, linux-kernel, kernel-janitors

The indenting here is confusing.

Also we don't check "ret".  That isn't likely to cause a runtime issue
because if it fails here fails then we'd probably return -EINVAL at the
end anyway.  But it does introduce a static checker warning since "val"
is only inititialized on the success path.

    drivers/regulator/ab8500.c:429 ab8500_regulator_get_mode()
    error: uninitialized symbol 'val'.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index 83dba3fbfe0c..4fab417f1803 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -425,7 +425,10 @@ static unsigned int ab8500_regulator_get_mode(struct regulator_dev *rdev)
 	if (info->mode_mask) {
 		/* Dedicated register for handling mode */
 		ret = abx500_get_register_interruptible(info->dev,
-		info->mode_bank, info->mode_reg, &val);
+							info->mode_bank,
+							info->mode_reg, &val);
+		if (ret)
+			return ret;
 		val = val & info->mode_mask;
 
 		val_normal = info->mode_val_normal;

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

* Re: [PATCH] regulator: ab8500: tidy ab8500_regulator_get_mode()
  2018-04-19 10:08 [PATCH] regulator: ab8500: tidy ab8500_regulator_get_mode() Dan Carpenter
@ 2018-04-20  8:12 ` Lee Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2018-04-20  8:12 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Liam Girdwood, Mark Brown, linux-kernel, kernel-janitors

On Thu, 19 Apr 2018, Dan Carpenter wrote:

> The indenting here is confusing.
> 
> Also we don't check "ret".  That isn't likely to cause a runtime issue
> because if it fails here fails then we'd probably return -EINVAL at the
> end anyway.  But it does introduce a static checker warning since "val"
> is only inititialized on the success path.
> 
>     drivers/regulator/ab8500.c:429 ab8500_regulator_get_mode()
>     error: uninitialized symbol 'val'.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Lee Jones <lee.jones@linaro.org>

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

end of thread, other threads:[~2018-04-20  8:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-19 10:08 [PATCH] regulator: ab8500: tidy ab8500_regulator_get_mode() Dan Carpenter
2018-04-20  8:12 ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).