All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Riku Voipio <riku.voipio@iki.fi>,
	kernel@pengutronix.de, linux-leds@vger.kernel.org
Subject: Re: [PATCH v3] leds: pca9532: Make pca9532_destroy_devices() return void
Date: Wed, 4 May 2022 19:38:51 +0200	[thread overview]
Message-ID: <20220504173851.GB8725@duo.ucw.cz> (raw)
In-Reply-To: <20211022101707.1194979-1-u.kleine-koenig@pengutronix.de>

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

Hi!

> Up to now pca9532_destroy_devices() returns always zero because it's
> always called with data != NULL. Remove the never-taken error path and
> make it return void which makes it easier to see in the callers that
> there is no error to handle.
> 
> Also the return value of i2c remove callbacks is ignored anyway.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Thank you, applied.

Best regards,
								Pavel



> ---
> How embarrassing, I fatfingered v2 that was supposed to fix compilation
> issues. I forgot to actuall add the needed changes and only adapted the
> commit log :-\
> 
> This one is good now (I hope!)
> 
> Sorry for the inconvenience,
> Uwe
> 
>  drivers/leds/leds-pca9532.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c
> index 017794bb87ae..f72b5d1be3a6 100644
> --- a/drivers/leds/leds-pca9532.c
> +++ b/drivers/leds/leds-pca9532.c
> @@ -318,13 +318,10 @@ static int pca9532_gpio_direction_output(struct gpio_chip *gc, unsigned offset,
>  }
>  #endif /* CONFIG_LEDS_PCA9532_GPIO */
>  
> -static int pca9532_destroy_devices(struct pca9532_data *data, int n_devs)
> +static void pca9532_destroy_devices(struct pca9532_data *data, int n_devs)
>  {
>  	int i = n_devs;
>  
> -	if (!data)
> -		return -EINVAL;
> -
>  	while (--i >= 0) {
>  		switch (data->leds[i].type) {
>  		case PCA9532_TYPE_NONE:
> @@ -346,8 +343,6 @@ static int pca9532_destroy_devices(struct pca9532_data *data, int n_devs)
>  	if (data->gpio.parent)
>  		gpiochip_remove(&data->gpio);
>  #endif
> -
> -	return 0;
>  }
>  
>  static int pca9532_configure(struct i2c_client *client,
> @@ -555,7 +550,9 @@ static int pca9532_remove(struct i2c_client *client)
>  {
>  	struct pca9532_data *data = i2c_get_clientdata(client);
>  
> -	return pca9532_destroy_devices(data, data->chip_info->num_leds);
> +	pca9532_destroy_devices(data, data->chip_info->num_leds);
> +
> +	return 0;
>  }
>  
>  module_i2c_driver(pca9532_driver);
> --

-- 
People of Russia, stop Putin before his war on Ukraine escalates.

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

      parent reply	other threads:[~2022-05-04 18:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21 12:11 [PATCH] leds: pca9532: Make pca9532_destroy_devices() return void Uwe Kleine-König
2021-10-21 12:16 ` [PATCH v2] " Uwe Kleine-König
2021-10-22 10:17   ` [PATCH v3] " Uwe Kleine-König
2022-01-10  7:23     ` Uwe Kleine-König
2022-01-11 21:12       ` Pavel Machek
2022-01-11 21:30         ` Uwe Kleine-König
2022-03-31 13:19           ` Uwe Kleine-König
2022-04-28 16:08             ` Uwe Kleine-König
2022-05-04 17:38     ` Pavel Machek [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=20220504173851.GB8725@duo.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=kernel@pengutronix.de \
    --cc=linux-leds@vger.kernel.org \
    --cc=riku.voipio@iki.fi \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 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.