Skip to content

Commit 3171d37

Browse files
hcodinawsakernel
authored andcommitted
i2c: muxes: i2c-mux-pinctrl: Use of_get_i2c_adapter_by_node()
i2c-mux-pinctrl uses the pair of_find_i2c_adapter_by_node() / i2c_put_adapter(). These pair alone is not correct to properly lock the I2C parent adapter. Indeed, i2c_put_adapter() decrements the module refcount while of_find_i2c_adapter_by_node() does not increment it. This leads to an underflow of the parent module refcount. Use the dedicated function, of_get_i2c_adapter_by_node(), to handle correctly the module refcount. Fixes: c4aee3e ("i2c: mux: pinctrl: remove platform_data") Signed-off-by: Herve Codina <herve.codina@bootlin.com> Cc: stable@vger.kernel.org Acked-by: Peter Rosin <peda@axentia.se> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent 54f1840 commit 3171d37

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/i2c/muxes/i2c-mux-pinctrl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static struct i2c_adapter *i2c_mux_pinctrl_parent_adapter(struct device *dev)
6262
dev_err(dev, "Cannot parse i2c-parent\n");
6363
return ERR_PTR(-ENODEV);
6464
}
65-
parent = of_find_i2c_adapter_by_node(parent_np);
65+
parent = of_get_i2c_adapter_by_node(parent_np);
6666
of_node_put(parent_np);
6767
if (!parent)
6868
return ERR_PTR(-EPROBE_DEFER);

0 commit comments

Comments
 (0)