diff mbox

Input: lm8323 - missing error check in lm8323_set_disable()

Message ID 20141202211710.GA19955@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter Dec. 2, 2014, 9:17 p.m. UTC
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>

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Dmitry Torokhov Dec. 3, 2014, 5:56 a.m. UTC | #1
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;
diff mbox

Patch

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;