Linux Input/HID development
 help / color / mirror / Atom feed
From: Nick Dyer <nick@shmanahar.org>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: linux-input@vger.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] Input: atmel_mxt_ts: Delete error messages for a failed memory allocation in two functions
Date: Wed, 24 Jan 2018 20:35:32 +0000	[thread overview]
Message-ID: <20180124203531.GA5922@lava.h.shmanahar.org> (raw)
In-Reply-To: <e6d21a83-6628-66f6-d7ce-bb5bf530faf2@users.sourceforge.net>

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
> 

      reply	other threads:[~2018-01-24 20:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180124203531.GA5922@lava.h.shmanahar.org \
    --to=nick@shmanahar.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=elfring@users.sourceforge.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox