All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] pwm: core: remove redundant assignment to pointer pwm
@ 2021-07-06 15:11 Colin King
  2021-07-06 15:58 ` Uwe Kleine-König
  0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2021-07-06 15:11 UTC (permalink / raw)
  To: Thierry Reding, Uwe Kleine-König, Lee Jones, linux-pwm
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The pointer pwm is being initialized with a value that is never read and
it is being updated later with a new value. The initialization is
redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/pwm/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index a28c8639af5b..35e894f4a379 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -846,7 +846,7 @@ EXPORT_SYMBOL_GPL(of_pwm_get);
  */
 static struct pwm_device *acpi_pwm_get(const struct fwnode_handle *fwnode)
 {
-	struct pwm_device *pwm = ERR_PTR(-ENODEV);
+	struct pwm_device *pwm;
 	struct fwnode_reference_args args;
 	struct pwm_chip *chip;
 	int ret;
-- 
2.31.1


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

* Re: [PATCH][next] pwm: core: remove redundant assignment to pointer pwm
  2021-07-06 15:11 [PATCH][next] pwm: core: remove redundant assignment to pointer pwm Colin King
@ 2021-07-06 15:58 ` Uwe Kleine-König
  2021-07-06 16:27   ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2021-07-06 15:58 UTC (permalink / raw)
  To: Colin King
  Cc: Thierry Reding, Lee Jones, linux-pwm, kernel-janitors,
	linux-kernel, Andy Shevchenko, Rafael J. Wysocki

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

Hello,

[adding Andy and Rafael to Cc:]

On Tue, Jul 06, 2021 at 04:11:32PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The pointer pwm is being initialized with a value that is never read and
> it is being updated later with a new value. The initialization is
> redundant and can be removed.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/pwm/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
> index a28c8639af5b..35e894f4a379 100644
> --- a/drivers/pwm/core.c
> +++ b/drivers/pwm/core.c
> @@ -846,7 +846,7 @@ EXPORT_SYMBOL_GPL(of_pwm_get);
>   */
>  static struct pwm_device *acpi_pwm_get(const struct fwnode_handle *fwnode)
>  {
> -	struct pwm_device *pwm = ERR_PTR(-ENODEV);
> +	struct pwm_device *pwm;
>  	struct fwnode_reference_args args;
>  	struct pwm_chip *chip;
>  	int ret;

LGTM:

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

and if you want:

Fixes: e5c38ba9f281 ("pwm: core: Reuse fwnode_to_pwmchip() in ACPI case")

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

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

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

* Re: [PATCH][next] pwm: core: remove redundant assignment to pointer pwm
  2021-07-06 15:58 ` Uwe Kleine-König
@ 2021-07-06 16:27   ` Andy Shevchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2021-07-06 16:27 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Colin King, Thierry Reding, Lee Jones, linux-pwm,
	kernel-janitors, linux-kernel, Rafael J. Wysocki

On Tue, Jul 06, 2021 at 05:58:20PM +0200, Uwe Kleine-König wrote:

> [adding Andy and Rafael to Cc:]

Thanks.

> On Tue, Jul 06, 2021 at 04:11:32PM +0100, Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> > 
> > The pointer pwm is being initialized with a value that is never read and
> > it is being updated later with a new value. The initialization is
> > redundant and can be removed.
> > 
> > Addresses-Coverity: ("Unused value")
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > ---
> >  drivers/pwm/core.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
> > index a28c8639af5b..35e894f4a379 100644
> > --- a/drivers/pwm/core.c
> > +++ b/drivers/pwm/core.c
> > @@ -846,7 +846,7 @@ EXPORT_SYMBOL_GPL(of_pwm_get);
> >   */
> >  static struct pwm_device *acpi_pwm_get(const struct fwnode_handle *fwnode)
> >  {
> > -	struct pwm_device *pwm = ERR_PTR(-ENODEV);
> > +	struct pwm_device *pwm;

I would move it after the next line...

> >  	struct fwnode_reference_args args;

...i.e. here

	struct pwm_device *pwm;

> >  	struct pwm_chip *chip;
> >  	int ret;
> 
> LGTM:
> 
> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> 
> and if you want:
> 
> Fixes: e5c38ba9f281 ("pwm: core: Reuse fwnode_to_pwmchip() in ACPI case")

With or without above comment addressed,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks for spotting and fixing this!

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2021-07-06 16:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 15:11 [PATCH][next] pwm: core: remove redundant assignment to pointer pwm Colin King
2021-07-06 15:58 ` Uwe Kleine-König
2021-07-06 16:27   ` Andy Shevchenko

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.