Re: [PATCH 3/3] iio: imu: bmi160: Remove potential undefined behavior in bmi160_config_pin()

From: Andy Shevchenko

Date: Mon Mar 09 2026 - 12:45:20 EST


On Mon, Mar 9, 2026 at 6:03 PM Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
>
> If 'pin' is not one of its expected values, the value of
> 'int_out_ctrl_shift' is undefined. With UBSAN enabled, this causes
> Clang to generate undefined behavior, resulting in the following
> warning:
>
> drivers/iio/imu/bmi160/bmi160_core.o: warning: objtool: bmi160_setup_irq() falls through to next function __cfi_bmi160_core_runtime_resume()
>
> Prevent the UB and improve error handling by adding a BUG() if 'pin' has
> an unexpected value.

> Cc: Jonathan Cameron <jic23@xxxxxxxxxx>
> Cc: David Lechner <dlechner@xxxxxxxxxxxx>
> CC: Nuno Sá <nuno.sa@xxxxxxxxxx>
> Cc: Andy Shevchenko <andy@xxxxxxxxxx>

Please, reduce the noise in the commit message by moving Cc list to be
below the '---' line. This will have the same effect on email (Git
tools work fine) and if anybody needs this information it will be
preserved in lore.kernel.org archive. In case you have questions about
handling this locally, there is a subthread (patch 18) of this series:
https://lore.kernel.org/lkml/20260123113708.416727-19-bigeasy@xxxxxxxxxxxxx/

--
With Best Regards,
Andy Shevchenko