All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] power: supply: da9150: Remove redundant error logging
@ 2022-12-22 17:18 Deepak R Varma
  2023-01-02 19:22 ` Sebastian Reichel
  0 siblings, 1 reply; 2+ messages in thread
From: Deepak R Varma @ 2022-12-22 17:18 UTC (permalink / raw)
  To: Support Opensource, Sebastian Reichel, linux-pm, linux-kernel
  Cc: Saurabh Singh Sengar, Praveen Kumar, drv

A call to platform_get_irq_byname() already prints an error on failure
within its own implementation. So printing another error based on its
return value in the caller is redundant and should be removed. The
clean up also makes if condition block braces and the device pointer
variable dev unnecessary. Remove those as well.

Issue identified using platform_get_irq.cocci coccinelle semantic patch.

Signed-off-by: Deepak R Varma <drv@mailo.com>
---
Note: The change was build tested using ARM64 defconfig.

 drivers/power/supply/da9150-charger.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/power/supply/da9150-charger.c b/drivers/power/supply/da9150-charger.c
index f9314cc0cd75..14da5c595dd9 100644
--- a/drivers/power/supply/da9150-charger.c
+++ b/drivers/power/supply/da9150-charger.c
@@ -466,10 +466,8 @@ static int da9150_charger_register_irq(struct platform_device *pdev,
 	int irq, ret;

 	irq = platform_get_irq_byname(pdev, irq_name);
-	if (irq < 0) {
-		dev_err(dev, "Failed to get IRQ CHG_STATUS: %d\n", irq);
+	if (irq < 0)
 		return irq;
-	}

 	ret = request_threaded_irq(irq, NULL, handler, IRQF_ONESHOT, irq_name,
 				   charger);
@@ -482,15 +480,12 @@ static int da9150_charger_register_irq(struct platform_device *pdev,
 static void da9150_charger_unregister_irq(struct platform_device *pdev,
 					  const char *irq_name)
 {
-	struct device *dev = &pdev->dev;
 	struct da9150_charger *charger = platform_get_drvdata(pdev);
 	int irq;

 	irq = platform_get_irq_byname(pdev, irq_name);
-	if (irq < 0) {
-		dev_err(dev, "Failed to get IRQ CHG_STATUS: %d\n", irq);
+	if (irq < 0)
 		return;
-	}

 	free_irq(irq, charger);
 }
--
2.34.1




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

* Re: [PATCH] power: supply: da9150: Remove redundant error logging
  2022-12-22 17:18 [PATCH] power: supply: da9150: Remove redundant error logging Deepak R Varma
@ 2023-01-02 19:22 ` Sebastian Reichel
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2023-01-02 19:22 UTC (permalink / raw)
  To: Deepak R Varma
  Cc: Support Opensource, linux-pm, linux-kernel, Saurabh Singh Sengar,
	Praveen Kumar

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

Hi,

On Thu, Dec 22, 2022 at 10:48:29PM +0530, Deepak R Varma wrote:
> A call to platform_get_irq_byname() already prints an error on failure
> within its own implementation. So printing another error based on its
> return value in the caller is redundant and should be removed. The
> clean up also makes if condition block braces and the device pointer
> variable dev unnecessary. Remove those as well.
> 
> Issue identified using platform_get_irq.cocci coccinelle semantic patch.
> 
> Signed-off-by: Deepak R Varma <drv@mailo.com>
> ---

Thanks, queued.

-- Sebastian

> Note: The change was build tested using ARM64 defconfig.
> 
>  drivers/power/supply/da9150-charger.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/power/supply/da9150-charger.c b/drivers/power/supply/da9150-charger.c
> index f9314cc0cd75..14da5c595dd9 100644
> --- a/drivers/power/supply/da9150-charger.c
> +++ b/drivers/power/supply/da9150-charger.c
> @@ -466,10 +466,8 @@ static int da9150_charger_register_irq(struct platform_device *pdev,
>  	int irq, ret;
> 
>  	irq = platform_get_irq_byname(pdev, irq_name);
> -	if (irq < 0) {
> -		dev_err(dev, "Failed to get IRQ CHG_STATUS: %d\n", irq);
> +	if (irq < 0)
>  		return irq;
> -	}
> 
>  	ret = request_threaded_irq(irq, NULL, handler, IRQF_ONESHOT, irq_name,
>  				   charger);
> @@ -482,15 +480,12 @@ static int da9150_charger_register_irq(struct platform_device *pdev,
>  static void da9150_charger_unregister_irq(struct platform_device *pdev,
>  					  const char *irq_name)
>  {
> -	struct device *dev = &pdev->dev;
>  	struct da9150_charger *charger = platform_get_drvdata(pdev);
>  	int irq;
> 
>  	irq = platform_get_irq_byname(pdev, irq_name);
> -	if (irq < 0) {
> -		dev_err(dev, "Failed to get IRQ CHG_STATUS: %d\n", irq);
> +	if (irq < 0)
>  		return;
> -	}
> 
>  	free_irq(irq, charger);
>  }
> --
> 2.34.1
> 
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2023-01-02 19:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-22 17:18 [PATCH] power: supply: da9150: Remove redundant error logging Deepak R Varma
2023-01-02 19:22 ` Sebastian Reichel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.