[PATCH] iio: dac: use int instead of u32 to store error codes

Qianfeng Rong posted 1 patch 1 month, 1 week ago
drivers/iio/dac/ad5360.c | 2 +-
drivers/iio/dac/ad5421.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
[PATCH] iio: dac: use int instead of u32 to store error codes
Posted by Qianfeng Rong 1 month, 1 week ago
Use int instead of unsigned int for 'ret' variable to store negative error
codes returned by ad5421_write_unlocked() and ad5360_write_unlocked().

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
 drivers/iio/dac/ad5360.c | 2 +-
 drivers/iio/dac/ad5421.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/dac/ad5360.c b/drivers/iio/dac/ad5360.c
index a57b0a093112..8271849b1c83 100644
--- a/drivers/iio/dac/ad5360.c
+++ b/drivers/iio/dac/ad5360.c
@@ -262,7 +262,7 @@ static int ad5360_update_ctrl(struct iio_dev *indio_dev, unsigned int set,
 	unsigned int clr)
 {
 	struct ad5360_state *st = iio_priv(indio_dev);
-	unsigned int ret;
+	int ret;
 
 	mutex_lock(&st->lock);
 
diff --git a/drivers/iio/dac/ad5421.c b/drivers/iio/dac/ad5421.c
index 1462ee640b16..d9d7031c4432 100644
--- a/drivers/iio/dac/ad5421.c
+++ b/drivers/iio/dac/ad5421.c
@@ -186,7 +186,7 @@ static int ad5421_update_ctrl(struct iio_dev *indio_dev, unsigned int set,
 	unsigned int clr)
 {
 	struct ad5421_state *st = iio_priv(indio_dev);
-	unsigned int ret;
+	int ret;
 
 	mutex_lock(&st->lock);
 
-- 
2.34.1
Re: [PATCH] iio: dac: use int instead of u32 to store error codes
Posted by Jonathan Cameron 1 month ago
On Tue, 26 Aug 2025 18:18:25 +0800
Qianfeng Rong <rongqianfeng@vivo.com> wrote:

> Use int instead of unsigned int for 'ret' variable to store negative error
> codes returned by ad5421_write_unlocked() and ad5360_write_unlocked().
> 
> Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
This is a fix, so needs a fixes tag.

Given the two drivers were introduced in separate patches
I would suggest splitting this into two different patches so
we can call out how far to backport each one (via the appropriate
fixes tags!)

> ---
>  drivers/iio/dac/ad5360.c | 2 +-
>  drivers/iio/dac/ad5421.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/dac/ad5360.c b/drivers/iio/dac/ad5360.c
> index a57b0a093112..8271849b1c83 100644
> --- a/drivers/iio/dac/ad5360.c
> +++ b/drivers/iio/dac/ad5360.c
> @@ -262,7 +262,7 @@ static int ad5360_update_ctrl(struct iio_dev *indio_dev, unsigned int set,
>  	unsigned int clr)
>  {
>  	struct ad5360_state *st = iio_priv(indio_dev);
> -	unsigned int ret;
> +	int ret;
>  
>  	mutex_lock(&st->lock);
>  
> diff --git a/drivers/iio/dac/ad5421.c b/drivers/iio/dac/ad5421.c
> index 1462ee640b16..d9d7031c4432 100644
> --- a/drivers/iio/dac/ad5421.c
> +++ b/drivers/iio/dac/ad5421.c
> @@ -186,7 +186,7 @@ static int ad5421_update_ctrl(struct iio_dev *indio_dev, unsigned int set,
>  	unsigned int clr)
>  {
>  	struct ad5421_state *st = iio_priv(indio_dev);
> -	unsigned int ret;
> +	int ret;
>  
>  	mutex_lock(&st->lock);
>
Re: [PATCH] iio: dac: use int instead of u32 to store error codes
Posted by Qianfeng Rong 1 month ago
在 2025/8/31 23:27, Jonathan Cameron 写道:
> On Tue, 26 Aug 2025 18:18:25 +0800
> Qianfeng Rong <rongqianfeng@vivo.com> wrote:
>
>> Use int instead of unsigned int for 'ret' variable to store negative error
>> codes returned by ad5421_write_unlocked() and ad5360_write_unlocked().
>>
>> Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
> This is a fix, so needs a fixes tag.
>
> Given the two drivers were introduced in separate patches
> I would suggest splitting this into two different patches so
> we can call out how far to backport each one (via the appropriate
> fixes tags!)

Okay, I’ll send the V2 version later.

Best regards,
Qianfeng

Re: [PATCH] iio: dac: use int instead of u32 to store error codes
Posted by David Lechner 1 month, 1 week ago
On 8/26/25 5:18 AM, Qianfeng Rong wrote:
> Use int instead of unsigned int for 'ret' variable to store negative error
> codes returned by ad5421_write_unlocked() and ad5360_write_unlocked().
> 
> Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
> ---
Reviewed-by: David Lechner <dlechner@baylibre.com>