linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] Input: lm8323 - missing error check in lm8323_set_disable()
@ 2014-12-02 21:17 Dan Carpenter
  2014-12-03  5:56 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2014-12-02 21:17 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Jingoo Han, Fugang Duan, Johan Hovold, Bryan Wu, linux-input,
	kernel-janitors

The missing error handling here is not especially harmful but static
checkers complain that "i" can be used uninitialized.

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

diff --git a/drivers/input/keyboard/lm8323.c b/drivers/input/keyboard/lm8323.c
index cb32e2b..21bea52 100644
--- a/drivers/input/keyboard/lm8323.c
+++ b/drivers/input/keyboard/lm8323.c
@@ -616,6 +616,8 @@ static ssize_t lm8323_set_disable(struct device *dev,
 	unsigned int i;
 
 	ret = kstrtouint(buf, 10, &i);
+	if (ret)
+		return ret;
 
 	mutex_lock(&lm->lock);
 	lm->kp_enabled = !i;

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

* Re: [patch] Input: lm8323 - missing error check in lm8323_set_disable()
  2014-12-02 21:17 [patch] Input: lm8323 - missing error check in lm8323_set_disable() Dan Carpenter
@ 2014-12-03  5:56 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2014-12-03  5:56 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jingoo Han, Fugang Duan, Johan Hovold, Bryan Wu, linux-input,
	kernel-janitors

On Wed, Dec 03, 2014 at 12:17:10AM +0300, Dan Carpenter wrote:
> The missing error handling here is not especially harmful but static
> checkers complain that "i" can be used uninitialized.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thank you.

> 
> diff --git a/drivers/input/keyboard/lm8323.c b/drivers/input/keyboard/lm8323.c
> index cb32e2b..21bea52 100644
> --- a/drivers/input/keyboard/lm8323.c
> +++ b/drivers/input/keyboard/lm8323.c
> @@ -616,6 +616,8 @@ static ssize_t lm8323_set_disable(struct device *dev,
>  	unsigned int i;
>  
>  	ret = kstrtouint(buf, 10, &i);
> +	if (ret)
> +		return ret;
>  
>  	mutex_lock(&lm->lock);
>  	lm->kp_enabled = !i;

-- 
Dmitry

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

end of thread, other threads:[~2014-12-03  5:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-02 21:17 [patch] Input: lm8323 - missing error check in lm8323_set_disable() Dan Carpenter
2014-12-03  5:56 ` Dmitry Torokhov

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).