mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Input: atmel_mxt_ts: Delete error messages for a failed memory allocation in two functions
@ 2018-01-21 21:33 SF Markus Elfring
  2018-01-24 20:35 ` Nick Dyer
  0 siblings, 1 reply; 2+ messages in thread
From: SF Markus Elfring @ 2018-01-21 21:33 UTC (permalink / raw)
  To: linux-input, Dmitry Torokhov, Nick Dyer; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 21 Jan 2018 22:25:31 +0100

Omit extra messages for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/input/touchscreen/atmel_mxt_ts.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 7659bc48f1db..f38711e9c256 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -1507,10 +1507,8 @@ static int mxt_update_cfg(struct mxt_data *data, const struct firmware *cfg)
 			MXT_INFO_CHECKSUM_SIZE;
 	config_mem_size = data->mem_size - cfg_start_ofs;
 	config_mem = kzalloc(config_mem_size, GFP_KERNEL);
-	if (!config_mem) {
-		dev_err(dev, "Failed to allocate memory\n");
+	if (!config_mem)
 		return -ENOMEM;
-	}
 
 	ret = mxt_prepare_cfg_mem(data, cfg, data_pos, cfg_start_ofs,
 				  config_mem, config_mem_size);
@@ -1612,10 +1610,8 @@ static int mxt_get_object_table(struct mxt_data *data)
 
 	table_size = data->info.object_num * sizeof(struct mxt_object);
 	object_table = kzalloc(table_size, GFP_KERNEL);
-	if (!object_table) {
-		dev_err(&data->client->dev, "Failed to allocate memory\n");
+	if (!object_table)
 		return -ENOMEM;
-	}
 
 	error = __mxt_read_reg(client, MXT_OBJECT_START, table_size,
 			object_table);
@@ -1714,7 +1710,6 @@ static int mxt_get_object_table(struct mxt_data *data)
 	data->msg_buf = kcalloc(data->max_reportid,
 				data->T5_msg_size, GFP_KERNEL);
 	if (!data->msg_buf) {
-		dev_err(&client->dev, "Failed to allocate message buffer\n");
 		error = -ENOMEM;
 		goto free_object_table;
 	}
-- 
2.16.0

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

* Re: [PATCH] Input: atmel_mxt_ts: Delete error messages for a failed memory allocation in two functions
  2018-01-21 21:33 [PATCH] Input: atmel_mxt_ts: Delete error messages for a failed memory allocation in two functions SF Markus Elfring
@ 2018-01-24 20:35 ` Nick Dyer
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Dyer @ 2018-01-24 20:35 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-input, Dmitry Torokhov, LKML, kernel-janitors

On Sun, Jan 21, 2018 at 10:33:50PM +0100, SF Markus Elfring wrote:
> Omit extra messages for a memory allocation failure in these functions.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Thanks!

Signed-off-by: Nick Dyer <nick@shmanahar.org>

> ---
>  drivers/input/touchscreen/atmel_mxt_ts.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
> index 7659bc48f1db..f38711e9c256 100644
> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> @@ -1507,10 +1507,8 @@ static int mxt_update_cfg(struct mxt_data *data, const struct firmware *cfg)
>  			MXT_INFO_CHECKSUM_SIZE;
>  	config_mem_size = data->mem_size - cfg_start_ofs;
>  	config_mem = kzalloc(config_mem_size, GFP_KERNEL);
> -	if (!config_mem) {
> -		dev_err(dev, "Failed to allocate memory\n");
> +	if (!config_mem)
>  		return -ENOMEM;
> -	}
>  
>  	ret = mxt_prepare_cfg_mem(data, cfg, data_pos, cfg_start_ofs,
>  				  config_mem, config_mem_size);
> @@ -1612,10 +1610,8 @@ static int mxt_get_object_table(struct mxt_data *data)
>  
>  	table_size = data->info.object_num * sizeof(struct mxt_object);
>  	object_table = kzalloc(table_size, GFP_KERNEL);
> -	if (!object_table) {
> -		dev_err(&data->client->dev, "Failed to allocate memory\n");
> +	if (!object_table)
>  		return -ENOMEM;
> -	}
>  
>  	error = __mxt_read_reg(client, MXT_OBJECT_START, table_size,
>  			object_table);
> @@ -1714,7 +1710,6 @@ static int mxt_get_object_table(struct mxt_data *data)
>  	data->msg_buf = kcalloc(data->max_reportid,
>  				data->T5_msg_size, GFP_KERNEL);
>  	if (!data->msg_buf) {
> -		dev_err(&client->dev, "Failed to allocate message buffer\n");
>  		error = -ENOMEM;
>  		goto free_object_table;
>  	}
> -- 
> 2.16.0
> 

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

end of thread, other threads:[~2018-01-24 20:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-21 21:33 [PATCH] Input: atmel_mxt_ts: Delete error messages for a failed memory allocation in two functions SF Markus Elfring
2018-01-24 20:35 ` Nick Dyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®