diff mbox series

mfd: cros_ec: simplify cros_ec_dev_init()

Message ID 20240819102326.5235-1-tzungbi@kernel.org (mailing list archive)
State Handled Elsewhere
Headers show
Series mfd: cros_ec: simplify cros_ec_dev_init() | expand

Commit Message

Tzung-Bi Shih Aug. 19, 2024, 10:23 a.m. UTC
From: Tzung-Bi Shih <tzungbi@kernel.org>

Simplify cros_ec_dev_init() by the following changes:
- Get rid of label `failed_devreg`.
- Remove a redundant space and comment.
- Use `if (ret)` instead of `if (ret < 0)`.

Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
 drivers/mfd/cros_ec_dev.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

Comments

Lee Jones Aug. 22, 2024, 10:11 a.m. UTC | #1
On Mon, 19 Aug 2024 18:23:26 +0800, tzungbi@kernel.org wrote:
> Simplify cros_ec_dev_init() by the following changes:
> - Get rid of label `failed_devreg`.
> - Remove a redundant space and comment.
> - Use `if (ret)` instead of `if (ret < 0)`.
> 
> 

Applied, thanks!

[1/1] mfd: cros_ec: simplify cros_ec_dev_init()
      commit: 70596c588adb5344e7002086d78ab5792d7d1069

--
Lee Jones [李琼斯]
diff mbox series

Patch

diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index e2aae8918679..55b30076763b 100644
--- a/drivers/mfd/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -353,22 +353,17 @@  static int __init cros_ec_dev_init(void)
 {
 	int ret;
 
-	ret  = class_register(&cros_class);
+	ret = class_register(&cros_class);
 	if (ret) {
 		pr_err(CROS_EC_DEV_NAME ": failed to register device class\n");
 		return ret;
 	}
 
-	/* Register the driver */
 	ret = platform_driver_register(&cros_ec_dev_driver);
-	if (ret < 0) {
+	if (ret) {
 		pr_warn(CROS_EC_DEV_NAME ": can't register driver: %d\n", ret);
-		goto failed_devreg;
+		class_unregister(&cros_class);
 	}
-	return 0;
-
-failed_devreg:
-	class_unregister(&cros_class);
 	return ret;
 }