linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Biju Das <biju.das.jz@bp.renesas.com>
Cc: Support Opensource <support.opensource@diasemi.com>,
	linux-input@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	Biju Das <biju.das.au@gmail.com>,
	linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v2 2/4] Input: da9063 - Drop redundant prints in probe()
Date: Mon, 18 Dec 2023 17:50:20 -0800	[thread overview]
Message-ID: <ZYD23GEe2Ex-yMLk@google.com> (raw)
In-Reply-To: <20231213214803.9931-3-biju.das.jz@bp.renesas.com>

On Wed, Dec 13, 2023 at 09:48:01PM +0000, Biju Das wrote:
> The memory allocation core code already prints error message in case of
> OOM. So, drop additional print messages for OOM cases.
> 
> While at it, input_register_device() is already printing error messages on
> failure. Drop the redundant print.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> v2:
>  * New patch.
> ---
>  drivers/input/misc/da9063_onkey.c | 23 ++++-------------------
>  1 file changed, 4 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/input/misc/da9063_onkey.c b/drivers/input/misc/da9063_onkey.c
> index 9351ce0bb405..80878274204e 100644
> --- a/drivers/input/misc/da9063_onkey.c
> +++ b/drivers/input/misc/da9063_onkey.c
> @@ -185,10 +185,8 @@ static int da9063_onkey_probe(struct platform_device *pdev)
>  
>  	onkey = devm_kzalloc(&pdev->dev, sizeof(struct da9063_onkey),
>  			     GFP_KERNEL);
> -	if (!onkey) {
> -		dev_err(&pdev->dev, "Failed to allocate memory.\n");
> +	if (!onkey)
>  		return -ENOMEM;
> -	}
>  
>  	onkey->config = device_get_match_data(&pdev->dev);
>  	if (!onkey->config)
> @@ -206,10 +204,8 @@ static int da9063_onkey_probe(struct platform_device *pdev)
>  						  "dlg,disable-key-power");
>  
>  	onkey->input = devm_input_allocate_device(&pdev->dev);
> -	if (!onkey->input) {
> -		dev_err(&pdev->dev, "Failed to allocated input device.\n");
> +	if (!onkey->input)
>  		return -ENOMEM;
> -	}
>  
>  	onkey->input->name = onkey->config->name;
>  	snprintf(onkey->phys, sizeof(onkey->phys), "%s/input0",
> @@ -221,12 +217,8 @@ static int da9063_onkey_probe(struct platform_device *pdev)
>  
>  	error = devm_delayed_work_autocancel(&pdev->dev, &onkey->work,
>  					     da9063_poll_on);
> -	if (error) {
> -		dev_err(&pdev->dev,
> -			"Failed to add cancel poll action: %d\n",
> -			error);
> +	if (error)
>  		return error;
> -	}
>  
>  	irq = platform_get_irq_byname(pdev, "ONKEY");
>  	if (irq < 0)
> @@ -250,14 +242,7 @@ static int da9063_onkey_probe(struct platform_device *pdev)
>  	else
>  		device_init_wakeup(&pdev->dev, true);
>  
> -	error = input_register_device(onkey->input);
> -	if (error) {
> -		dev_err(&pdev->dev,
> -			"Failed to register input device: %d\n", error);
> -		return error;
> -	}
> -
> -	return 0;
> +	return input_register_device(onkey->input);

When there are multiple exit points I prefer all of them to use form

	error = action(...);
	if (error)
		return error;

	...
	return 0;

Fixed up and applied, thank you.

Thanks.

-- 
Dmitry

  reply	other threads:[~2023-12-19  1:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-13 21:47 [PATCH v2 0/4] Add polling support for DA9063 onkey driver Biju Das
2023-12-13 21:48 ` [PATCH v2 1/4] Input: da9063 - Simplify obtaining OF match data Biju Das
2023-12-19  1:48   ` Dmitry Torokhov
2023-12-13 21:48 ` [PATCH v2 2/4] Input: da9063 - Drop redundant prints in probe() Biju Das
2023-12-19  1:50   ` Dmitry Torokhov [this message]
2023-12-13 21:48 ` [PATCH v2 3/4] Input: da9063 - Use dev_err_probe() Biju Das
2023-12-19  1:50   ` Dmitry Torokhov
2023-12-13 21:48 ` [PATCH v2 4/4] Input: da9063 - Add polling support Biju Das
2023-12-19  1:52   ` Dmitry Torokhov
2024-01-25 11:52     ` Biju Das

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=ZYD23GEe2Ex-yMLk@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=biju.das.au@gmail.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=support.opensource@diasemi.com \
    /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;
as well as URLs for NNTP newsgroup(s).