platform/chrome: cros_ec: fix error handling in cros_ec_register()
authorTzung-Bi Shih <tzungbi@kernel.org>
Wed, 16 Feb 2022 08:03:02 +0000 (16:03 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:23:05 +0000 (10:23 +0200)
commit9816480848c3e2b0c9c8c75b0180b17ab6a8d84d
treee734b7e44a8539b8b8a54948f6d5d1c456e8f755
parent55e1c42d968f1dc14e32cbc535d65d9a73602b7d
platform/chrome: cros_ec: fix error handling in cros_ec_register()

[ Upstream commit 2cd01bd6b117df07b1bc2852f08694fdd29e40ed ]

Fix cros_ec_register() to unregister platform devices if
blocking_notifier_chain_register() fails.

Also use the single exit path to handle the platform device
unregistration.

Fixes: 42cd0ab476e2 ("platform/chrome: cros_ec: Query EC protocol version if EC transitions between RO/RW")
Reviewed-by: Prashant Malani <pmalani@chromium.org>
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/platform/chrome/cros_ec.c