i2c: mux: demux-pinctrl: do not deactivate a master that is not active
authorPeter Rosin <peda@axentia.se>
Wed, 2 Mar 2022 11:22:35 +0000 (12:22 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Apr 2022 07:08:19 +0000 (09:08 +0200)
commit97452456c1e47d0e65c47a3e2c65cace178f3cb3
tree424cb6129468e84a4608cd8c7751426115f3f655
parentac5883a8890a11c00b32a19949a25d4afeaa2f5a
i2c: mux: demux-pinctrl: do not deactivate a master that is not active

[ Upstream commit 1a22aabf20adf89cb216f566913196128766f25b ]

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: e9d1a0a41d44 ("i2c: mux: demux-pinctrl: Fix an error handling path in 'i2c_demux_pinctrl_probe()'")
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/i2c/muxes/i2c-demux-pinctrl.c