mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 10:09:10 +02:00
i2c: core: fix adapter probe deferral loop
Drivers must not probe defer after having registered devices as that will trigger a probe loop if the devices bind to a driver (cf. commitfbc35b45f9("Add documentation on meaning of -EPROBE_DEFER")). Move the recovery initialisation, where the GPIO lookup may fail, before registering the adapter to prevent this. Fixes:75820314de("i2c: core: add generic I2C GPIO recovery") Cc: stable@vger.kernel.org # 5.9 Cc: Codrin Ciubotariu <codrin.ciubotariu@microchip.com> Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
This commit is contained in:
parent
2295d2bb10
commit
158efa411c
|
|
@ -1562,6 +1562,10 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
|
|||
adap->dev.type = &i2c_adapter_type;
|
||||
device_initialize(&adap->dev);
|
||||
|
||||
res = i2c_init_recovery(adap);
|
||||
if (res == -EPROBE_DEFER)
|
||||
goto err_put_adap;
|
||||
|
||||
/*
|
||||
* This adapter can be used as a parent immediately after device_add(),
|
||||
* setup runtime-pm (especially ignore-children) before hand.
|
||||
|
|
@ -1583,10 +1587,6 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
|
|||
if (res)
|
||||
goto out_reg;
|
||||
|
||||
res = i2c_init_recovery(adap);
|
||||
if (res == -EPROBE_DEFER)
|
||||
goto out_reg;
|
||||
|
||||
dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name);
|
||||
|
||||
/* create pre-declared device nodes */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user