linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: bcm_iproc_tsc - Make use of the helper function dev_err_probe()
@ 2021-09-16 15:31 Cai Huoqing
  2021-09-16 17:02 ` Ray Jui
  0 siblings, 1 reply; 2+ messages in thread
From: Cai Huoqing @ 2021-09-16 15:31 UTC (permalink / raw)
  To: caihuoqing
  Cc: Dmitry Torokhov, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list, linux-input, linux-arm-kernel,
	linux-kernel

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/input/touchscreen/bcm_iproc_tsc.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/input/touchscreen/bcm_iproc_tsc.c b/drivers/input/touchscreen/bcm_iproc_tsc.c
index 7de1fd24ce36..c6aaeaee1d12 100644
--- a/drivers/input/touchscreen/bcm_iproc_tsc.c
+++ b/drivers/input/touchscreen/bcm_iproc_tsc.c
@@ -441,12 +441,9 @@ static int iproc_ts_probe(struct platform_device *pdev)
 	}
 
 	priv->tsc_clk = devm_clk_get(&pdev->dev, "tsc_clk");
-	if (IS_ERR(priv->tsc_clk)) {
-		error = PTR_ERR(priv->tsc_clk);
-		dev_err(&pdev->dev,
-			"failed getting clock tsc_clk: %d\n", error);
-		return error;
-	}
+	if (IS_ERR(priv->tsc_clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->tsc_clk),
+				     "failed getting clock tsc_clk\n");
 
 	priv->pdev = pdev;
 	error = iproc_get_tsc_config(&pdev->dev, priv);
-- 
2.25.1


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

* Re: [PATCH] Input: bcm_iproc_tsc - Make use of the helper function dev_err_probe()
  2021-09-16 15:31 [PATCH] Input: bcm_iproc_tsc - Make use of the helper function dev_err_probe() Cai Huoqing
@ 2021-09-16 17:02 ` Ray Jui
  0 siblings, 0 replies; 2+ messages in thread
From: Ray Jui @ 2021-09-16 17:02 UTC (permalink / raw)
  To: Cai Huoqing
  Cc: Dmitry Torokhov, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list, linux-input, linux-arm-kernel,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1336 bytes --]



On 9/16/2021 8:31 AM, Cai Huoqing wrote:
> When possible use dev_err_probe help to properly deal with the
> PROBE_DEFER error, the benefit is that DEFER issue will be logged
> in the devices_deferred debugfs file.
> Using dev_err_probe() can reduce code size, and the error value
> gets printed.
> 
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
> ---
>  drivers/input/touchscreen/bcm_iproc_tsc.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/bcm_iproc_tsc.c b/drivers/input/touchscreen/bcm_iproc_tsc.c
> index 7de1fd24ce36..c6aaeaee1d12 100644
> --- a/drivers/input/touchscreen/bcm_iproc_tsc.c
> +++ b/drivers/input/touchscreen/bcm_iproc_tsc.c
> @@ -441,12 +441,9 @@ static int iproc_ts_probe(struct platform_device *pdev)
>  	}
>  
>  	priv->tsc_clk = devm_clk_get(&pdev->dev, "tsc_clk");
> -	if (IS_ERR(priv->tsc_clk)) {
> -		error = PTR_ERR(priv->tsc_clk);
> -		dev_err(&pdev->dev,
> -			"failed getting clock tsc_clk: %d\n", error);
> -		return error;
> -	}
> +	if (IS_ERR(priv->tsc_clk))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(priv->tsc_clk),
> +				     "failed getting clock tsc_clk\n");
>  
>  	priv->pdev = pdev;
>  	error = iproc_get_tsc_config(&pdev->dev, priv);
> 

Improvement looks good to me. Thanks.

Acked-by: Ray Jui <ray.jui@broadcom.com>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4194 bytes --]

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

end of thread, other threads:[~2021-09-16 18:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16 15:31 [PATCH] Input: bcm_iproc_tsc - Make use of the helper function dev_err_probe() Cai Huoqing
2021-09-16 17:02 ` Ray Jui

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).