[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZApLfPnPdJkCIQYt@shikoro>
Date: Thu, 9 Mar 2023 22:11:24 +0100
From: Wolfram Sang <wsa@...nel.org>
To: Geert Uytterhoeven <geert+renesas@...der.be>
Cc: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
linux-i2c@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] i2c: dev: Fix bus callback return values
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@...der.be>
Applied to for-current, thanks!
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists