Re: [PATCH] staging: iio: addac: adt7316: return 0 in _adt7316_store_enabled

From: Dan Carpenter

Date: Wed Nov 04 2026 - 02:55:24 EST


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@xxxxxxxxx>
> ---

Reviewed-by: Dan Carpenter <error27@xxxxxxxxx>

regards,
dan carpenter