diff mbox

Input: sx8654 - fix memory allocation check

Message ID 20150508235031.GA29274@dtor-ws (mailing list archive)
State New, archived
Headers show

Commit Message

Dmitry Torokhov May 8, 2015, 11:50 p.m. UTC
We have been testing wrong variable when trying to make sure that input
allocation succeeded.

Reported by Coverity (CID 1295918).

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/sx8654.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sébastien Szymanski May 11, 2015, 9:51 a.m. UTC | #1
Hello,

Acked-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>

On 05/09/2015 01:50 AM, Dmitry Torokhov wrote:
> We have been testing wrong variable when trying to make sure that input
> allocation succeeded.
> 
> Reported by Coverity (CID 1295918).
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>  drivers/input/touchscreen/sx8654.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/sx8654.c b/drivers/input/touchscreen/sx8654.c
> index aecb9ad..642f4a5 100644
> --- a/drivers/input/touchscreen/sx8654.c
> +++ b/drivers/input/touchscreen/sx8654.c
> @@ -187,7 +187,7 @@ static int sx8654_probe(struct i2c_client *client,
>  		return -ENOMEM;
>  
>  	input = devm_input_allocate_device(&client->dev);
> -	if (!sx8654)
> +	if (!input)
>  		return -ENOMEM;
>  
>  	input->name = "SX8654 I2C Touchscreen";
>
diff mbox

Patch

diff --git a/drivers/input/touchscreen/sx8654.c b/drivers/input/touchscreen/sx8654.c
index aecb9ad..642f4a5 100644
--- a/drivers/input/touchscreen/sx8654.c
+++ b/drivers/input/touchscreen/sx8654.c
@@ -187,7 +187,7 @@  static int sx8654_probe(struct i2c_client *client,
 		return -ENOMEM;
 
 	input = devm_input_allocate_device(&client->dev);
-	if (!sx8654)
+	if (!input)
 		return -ENOMEM;
 
 	input->name = "SX8654 I2C Touchscreen";