Skip to content

Commit 1a22aab

Browse files
peda-rwsakernel
authored andcommitted
i2c: mux: demux-pinctrl: do not deactivate a master that is not active
Attempting to rollback the activation of the current master when the current master has not been activated is bad. priv->cur_chan and priv->cur_adap are both still zeroed out and the rollback may result in attempts to revert an of changeset that has not been applied and do result in calls to both del and put the zeroed out i2c_adapter. Maybe it crashes, or whatever, but it's bad in any case. Fixes: e9d1a0a ("i2c: mux: demux-pinctrl: Fix an error handling path in 'i2c_demux_pinctrl_probe()'") Signed-off-by: Peter Rosin <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent cb13aa1 commit 1a22aab

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev)
261261

262262
err = device_create_file(&pdev->dev, &dev_attr_available_masters);
263263
if (err)
264-
goto err_rollback;
264+
goto err_rollback_activation;
265265

266266
err = device_create_file(&pdev->dev, &dev_attr_current_master);
267267
if (err)
@@ -271,8 +271,9 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev)
271271

272272
err_rollback_available:
273273
device_remove_file(&pdev->dev, &dev_attr_available_masters);
274-
err_rollback:
274+
err_rollback_activation:
275275
i2c_demux_deactivate_master(priv);
276+
err_rollback:
276277
for (j = 0; j < i; j++) {
277278
of_node_put(priv->chan[j].parent_np);
278279
of_changeset_destroy(&priv->chan[j].chgset);

0 commit comments

Comments
 (0)