Skip to content

Commit 0fb118d

Browse files
hcodinawsakernel
authored andcommitted
i2c: muxes: i2c-demux-pinctrl: Use of_get_i2c_adapter_by_node()
i2c-demux-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: 50a5ba8 ("i2c: mux: demux-pinctrl: add driver") Signed-off-by: Herve Codina <[email protected]> Cc: [email protected] Acked-by: Peter Rosin <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 3171d37 commit 0fb118d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static int i2c_demux_activate_master(struct i2c_demux_pinctrl_priv *priv, u32 ne
6161
if (ret)
6262
goto err;
6363

64-
adap = of_find_i2c_adapter_by_node(priv->chan[new_chan].parent_np);
64+
adap = of_get_i2c_adapter_by_node(priv->chan[new_chan].parent_np);
6565
if (!adap) {
6666
ret = -ENODEV;
6767
goto err_with_revert;

0 commit comments

Comments
 (0)