On Thu, Mar 09, 2023 at 08:45:46AM +0100, Geert Uytterhoeven wrote: > The i2cdev_{at,de}tach_adapter() callbacks are used for two purposes: > 1. As notifier callbacks, when (un)registering I2C adapters created or > destroyed after i2c_dev_init(), > 2. As bus iterator callbacks, for registering already existing > adapters from i2c_dev_init(), and for cleanup. > > Unfortunately both use cases expect different return values: the former > expects NOTIFY_* return codes, while the latter expects zero or error > codes, and aborts in case of error. > > Hence in case 2, as soon as i2cdev_{at,de}tach_adapter() returns > (non-zero) NOTIFY_OK, the bus iterator aborts. This causes (a) only the > first already existing adapter to be registered, leading to missing > /dev/i2c-* entries, and (b) a failure to unregister all but the first > I2C adapter during cleanup. > > Fix this by introducing separate callbacks for the bus iterator, > wrapping the notifier functions, and always returning succes. > Any errors inside these callback functions are unlikely to happen, and > are fatal anyway. > > Fixes: cddf70d0bce71c2a ("i2c: dev: fix notifier return values") > Signed-off-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx> Applied to for-current, thanks!
Attachment:
signature.asc
Description: PGP signature