Linux kernel staging patches
 help / color / mirror / Atom feed
* [PATCH] staging: iio: addac: adt7316: return 0 in _adt7316_store_enabled
@ 2026-11-04  4:10 Maria Sheikh
  2026-11-04  7:47 ` Dan Carpenter
  2026-11-04  8:00 ` Joshua Crofts
  0 siblings, 2 replies; 3+ messages in thread
From: Maria Sheikh @ 2026-11-04  4:10 UTC (permalink / raw)
  To: outreachy, nuno.sa, Michael.Hennerich, jic23, dlechner, andy,
	gregkh, linux, linux-iio, linux-staging, linux-kernel
  Cc: Maria Sheikh

_adt7316_store_enabled() writes the config register and returns -EIO if
the write fails. When execution reaches the final "return ret;", the
write has succeeded, so ret is always 0. Return 0 directly to make the
success path obvious.

Found with cppcheck (identicalConditionAfterEarlyExit). All callers
either check for a negative return value or pass it through, so
behavior does not change.

Compile-tested with W=1. The disassembly of adt7316.o is identical
before and after this change.

Signed-off-by: Maria Sheikh <mariasheikh812@gmail.com>
---
 drivers/staging/iio/addac/adt7316.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
index 20f6052cc7fb..4cb03e7808ab 100644
--- a/drivers/staging/iio/addac/adt7316.c
+++ b/drivers/staging/iio/addac/adt7316.c
@@ -236,7 +236,7 @@ static ssize_t _adt7316_store_enabled(struct adt7316_chip_info *chip,
 
 	chip->config1 = config1;
 
-	return ret;
+	return 0;
 }
 
 static ssize_t adt7316_store_enabled(struct device *dev,
-- 
2.53.0


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

* Re: [PATCH] staging: iio: addac: adt7316: return 0 in _adt7316_store_enabled
  2026-11-04  4:10 [PATCH] staging: iio: addac: adt7316: return 0 in _adt7316_store_enabled Maria Sheikh
@ 2026-11-04  7:47 ` Dan Carpenter
  2026-11-04  8:00 ` Joshua Crofts
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2026-11-04  7:47 UTC (permalink / raw)
  To: Maria Sheikh
  Cc: outreachy, nuno.sa, Michael.Hennerich, jic23, dlechner, andy,
	gregkh, linux, linux-iio, linux-staging, linux-kernel

On Wed, Nov 04, 2026 at 09:10:45AM +0500, Maria Sheikh wrote:
> _adt7316_store_enabled() writes the config register and returns -EIO if
> the write fails. When execution reaches the final "return ret;", the
> write has succeeded, so ret is always 0. Return 0 directly to make the
> success path obvious.
> 
> Found with cppcheck (identicalConditionAfterEarlyExit). All callers
> either check for a negative return value or pass it through, so
> behavior does not change.
> 
> Compile-tested with W=1. The disassembly of adt7316.o is identical
> before and after this change.
> 
> Signed-off-by: Maria Sheikh <mariasheikh812@gmail.com>
> ---

Reviewed-by: Dan Carpenter <error27@gmail.com>

regards,
dan carpenter


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

* Re: [PATCH] staging: iio: addac: adt7316: return 0 in _adt7316_store_enabled
  2026-11-04  4:10 [PATCH] staging: iio: addac: adt7316: return 0 in _adt7316_store_enabled Maria Sheikh
  2026-11-04  7:47 ` Dan Carpenter
@ 2026-11-04  8:00 ` Joshua Crofts
  1 sibling, 0 replies; 3+ messages in thread
From: Joshua Crofts @ 2026-11-04  8:00 UTC (permalink / raw)
  To: Maria Sheikh
  Cc: outreachy, nuno.sa, Michael.Hennerich, jic23, dlechner, andy,
	gregkh, linux, linux-iio, linux-staging, linux-kernel

On Wed,  4 Nov 2026 09:10:45 +0500
Maria Sheikh <mariasheikh812@gmail.com> wrote:

> _adt7316_store_enabled() writes the config register and returns -EIO if
> the write fails. When execution reaches the final "return ret;", the
> write has succeeded, so ret is always 0. Return 0 directly to make the
> success path obvious.
> 
> Found with cppcheck (identicalConditionAfterEarlyExit). All callers
> either check for a negative return value or pass it through, so
> behavior does not change.
> 
> Compile-tested with W=1. The disassembly of adt7316.o is identical
> before and after this change.

I'd move the testing info below the ---, as it's only compile tested.
No need to resend however, this can be fixed up when applying.

Reviewed-by: Joshua Crofts <crofts@kernel.org>

-- 
Kind regards,
Joshua Crofts

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

end of thread, other threads:[~2026-11-04  8:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-04  4:10 [PATCH] staging: iio: addac: adt7316: return 0 in _adt7316_store_enabled Maria Sheikh
2026-11-04  7:47 ` Dan Carpenter
2026-11-04  8:00 ` Joshua Crofts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox