Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: David Heidelberg via B4 Relay <devnull+david.ixit.cz@kernel.org>
Cc: david@ixit.cz, Lars-Peter Clausen <lars@metafoo.de>,
	Svyatoslav Ryhel <clamor95@gmail.com>,
	Robert Eckelmann <longnoserob@gmail.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 3/5] iio: light: al3320a: Fix an error handling path in al3320a_probe()
Date: Sat, 5 Apr 2025 17:59:42 +0100	[thread overview]
Message-ID: <20250405175942.6264673f@jic23-huawei> (raw)
In-Reply-To: <20250402-al3010-iio-regmap-v4-3-d189bea87261@ixit.cz>

On Wed, 02 Apr 2025 21:33:26 +0200
David Heidelberg via B4 Relay <devnull+david.ixit.cz@kernel.org> wrote:

> From: David Heidelberg <david@ixit.cz>
> 
> If regmap_write() fails in al3320a_init(), al3320a_set_pwr_off is
> not called.
> 
> In order to avoid such a situation, move the devm_add_action_or_reset()
> which calls al3320a_set_pwr_off right after a successful
> al3320a_set_pwr_on.
> 
> Signed-off-by: David Heidelberg <david@ixit.cz>
> ---
>  drivers/iio/light/al3320a.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/light/al3320a.c b/drivers/iio/light/al3320a.c
> index 1b2b0359ed5dad5e00d2fe584f8f3495c13c997e..1fa693d54ae2a6e5ead3a9c7ac7018afeba9b760 100644
> --- a/drivers/iio/light/al3320a.c
> +++ b/drivers/iio/light/al3320a.c
> @@ -101,6 +101,12 @@ static int al3320a_init(struct al3320a_data *data)
>  	if (ret < 0)
>  		return ret;
>  
> +	ret = devm_add_action_or_reset(&data->client->dev,
> +				       al3320a_set_pwr_off,
> +				       data);
> +	if (ret)
> +		return dev_err_probe(&data->client->dev, ret, "failed to add action\n");
This one I'll drop whilst applying given we are adding a message with little
purpose (or chance of occurring) rather than moving one as we were in patch 2.

I've applied up to this patch with those tweaks. I might well pick up the others but
not looked closely at them yet!
> +
>  	ret = i2c_smbus_write_byte_data(data->client, AL3320A_REG_CONFIG_RANGE,
>  					FIELD_PREP(AL3320A_GAIN_MASK,
>  						   AL3320A_RANGE_3));
> @@ -211,10 +217,6 @@ static int al3320a_probe(struct i2c_client *client)
>  		return ret;
>  	}
>  
> -	ret = devm_add_action_or_reset(dev, al3320a_set_pwr_off, data);
> -	if (ret < 0)
> -		return ret;
> -
>  	return devm_iio_device_register(dev, indio_dev);
>  }
>  
> 


  reply	other threads:[~2025-04-05 16:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-02 19:33 [PATCH v4 0/5] iio: light: Modernize al3010 and al3320a codebase David Heidelberg via B4 Relay
2025-04-02 19:33 ` [PATCH v4 1/5] iio: light: al3010: Improve al3010_init error handling with dev_err_probe() David Heidelberg via B4 Relay
2025-04-03 18:01   ` Christophe JAILLET
2025-04-05 16:52     ` Jonathan Cameron
2025-04-02 19:33 ` [PATCH v4 2/5] iio: light: al3000a: Fix an error handling path in al3000a_probe() David Heidelberg via B4 Relay
2025-04-05 16:57   ` Jonathan Cameron
2025-04-02 19:33 ` [PATCH v4 3/5] iio: light: al3320a: Fix an error handling path in al3320a_probe() David Heidelberg via B4 Relay
2025-04-05 16:59   ` Jonathan Cameron [this message]
2025-04-02 19:33 ` [PATCH v4 4/5] iio: light: al3010: Implement regmap support David Heidelberg via B4 Relay
2025-04-02 19:33 ` [PATCH v4 5/5] iio: light: al3320a: " David Heidelberg via B4 Relay
2025-04-05 17:12 ` [PATCH v4 0/5] iio: light: Modernize al3010 and al3320a codebase Jonathan Cameron
2025-04-06 13:01   ` David Heidelberg

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=20250405175942.6264673f@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=clamor95@gmail.com \
    --cc=david@ixit.cz \
    --cc=devnull+david.ixit.cz@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longnoserob@gmail.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