sca3000_stop_all_interrupts() is called only from the driver remove
path and its return value is discarded, so convert the helper to return
void.
No functional change.
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
drivers/iio/accel/sca3000.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c
index 4bad152009e8..f9680071bbbe 100644
--- a/drivers/iio/accel/sca3000.c
+++ b/drivers/iio/accel/sca3000.c
@@ -1495,22 +1495,21 @@ static int sca3000_probe(struct spi_device *spi)
return 0;
}
-static int sca3000_stop_all_interrupts(struct sca3000_state *st)
+static void sca3000_stop_all_interrupts(struct sca3000_state *st)
{
int ret;
mutex_lock(&st->lock);
ret = sca3000_read_data_short(st, SCA3000_REG_INT_MASK_ADDR, 1);
if (ret)
- goto error_ret;
- ret = sca3000_write_reg(st, SCA3000_REG_INT_MASK_ADDR,
- (st->rx[0] &
- ~(SCA3000_REG_INT_MASK_RING_THREE_QUARTER |
- SCA3000_REG_INT_MASK_RING_HALF |
- SCA3000_REG_INT_MASK_ALL_INTS)));
-error_ret:
+ goto out_unlock;
+ sca3000_write_reg(st, SCA3000_REG_INT_MASK_ADDR,
+ (st->rx[0] &
+ ~(SCA3000_REG_INT_MASK_RING_THREE_QUARTER |
+ SCA3000_REG_INT_MASK_RING_HALF |
+ SCA3000_REG_INT_MASK_ALL_INTS)));
+out_unlock:
mutex_unlock(&st->lock);
- return ret;
}
static void sca3000_remove(struct spi_device *spi)
--
2.47.3
On Tue, Feb 03, 2026 at 10:11:58PM -0800, Harshit Mogalapalli wrote: > sca3000_stop_all_interrupts() is called only from the driver remove > path and its return value is discarded, so convert the helper to return > void. > > No functional change. Yeah, as I just replied, the prerequisite for this should be move upper in the code where you are going to use it in the future. ... > ret = sca3000_read_data_short(st, SCA3000_REG_INT_MASK_ADDR, 1); > if (ret) > - goto error_ret; > -error_ret: > + goto out_unlock; > +out_unlock: While this is correct change semantically, it's not needed as very soon the other patch drops this for good, hence leave the label name unmodified. -- With Best Regards, Andy Shevchenko
Hi Andy, On 04/02/26 14:33, Andy Shevchenko wrote: > On Tue, Feb 03, 2026 at 10:11:58PM -0800, Harshit Mogalapalli wrote: >> sca3000_stop_all_interrupts() is called only from the driver remove >> path and its return value is discarded, so convert the helper to return >> void. >> >> No functional change. > > Yeah, as I just replied, the prerequisite for this should be move upper in the > code where you are going to use it in the future. > Sure, will do that! That would make reviewing simpler. > ... > >> ret = sca3000_read_data_short(st, SCA3000_REG_INT_MASK_ADDR, 1); >> if (ret) >> - goto error_ret; > >> -error_ret: >> + goto out_unlock; > >> +out_unlock: > > While this is correct change semantically, it's not needed as very soon > the other patch drops this for good, hence leave the label name unmodified. > Agree, I was doubtful on which is the preferred approach as its not really a return anymore. But thanks for explaining. Regards, Harshit
On Wed, Feb 04, 2026 at 02:50:54PM +0530, Harshit Mogalapalli wrote: > On 04/02/26 14:33, Andy Shevchenko wrote: > > On Tue, Feb 03, 2026 at 10:11:58PM -0800, Harshit Mogalapalli wrote: ... > > > ret = sca3000_read_data_short(st, SCA3000_REG_INT_MASK_ADDR, 1); > > > if (ret) > > > - goto error_ret; > > > > > -error_ret: > > > + goto out_unlock; > > > > > +out_unlock: > > > > While this is correct change semantically, it's not needed as very soon > > the other patch drops this for good, hence leave the label name unmodified. > > Agree, I was doubtful on which is the preferred approach as its not really a > return anymore. But thanks for explaining. The common sense says that we need to avoid ping-pong coding (*) in the series. *It's when one patch in the series adds the code that's going to be deleted or heavily modified just later in the very same series. -- With Best Regards, Andy Shevchenko
Hi Andy, On 04/02/26 15:31, Andy Shevchenko wrote: > On Wed, Feb 04, 2026 at 02:50:54PM +0530, Harshit Mogalapalli wrote: >> On 04/02/26 14:33, Andy Shevchenko wrote: >>> On Tue, Feb 03, 2026 at 10:11:58PM -0800, Harshit Mogalapalli wrote: > > ... > >>>> ret = sca3000_read_data_short(st, SCA3000_REG_INT_MASK_ADDR, 1); >>>> if (ret) >>>> - goto error_ret; >>> >>>> -error_ret: >>>> + goto out_unlock; >>> >>>> +out_unlock: >>> >>> While this is correct change semantically, it's not needed as very soon >>> the other patch drops this for good, hence leave the label name unmodified. >> >> Agree, I was doubtful on which is the preferred approach as its not really a >> return anymore. But thanks for explaining. > > The common sense says that we need to avoid ping-pong coding (*) in the series. > > *It's when one patch in the series adds the code that's going to be deleted or > heavily modified just later in the very same series. > Sure thanks for explaining, I was thinking about it from a backport point of view(say this patch is auto selected as a prerequisite for applying another patch, but guard patch is not selected because there is no cleanup.h is some older kernel), in that case if this patch alone gets backported but not the gaurd() patch, err_return label might not look great. But I agree its not likely to happen in this case. Thanks for sharing your thoughts. Regards, Harshit
© 2016 - 2026 Red Hat, Inc.