Re: [PATCH v5 04/10] iio: light: gp2ap020a00f: Return directly from the switch cases
From: Andy Shevchenko
Date: Mon Feb 23 2026 - 07:06:03 EST
On Sun, Feb 22, 2026 at 09:40:14PM -0600, Ethan Tidmore wrote:
> Return directly from the switch cases which makes code easier to follow.
> In some cases convert pieces to the standard pattern which also unifies
> it with the accepted kernel practices.
...
> static int gp2ap020a00f_exec_cmd(struct gp2ap020a00f_data *data,
> GP2AP020A00F_OPMODE_SHUTDOWN);
> if (err < 0)
> return err;
> - err = gp2ap020a00f_write_event_threshold(data,
> + return gp2ap020a00f_write_event_threshold(data,
> GP2AP020A00F_THRESH_PL, false);
> - break;
> }
> - return err;
> + return 0;
I would make it also to be a 'default' case. But the driver uses different
styles anyway and I can't easily find a common denominator, so it's fine to
have it like this.
--
With Best Regards,
Andy Shevchenko