Chrome platform driver development
 help / color / mirror / Atom feed
* [PATCH] mfd: cros_ec: simplify cros_ec_dev_init()
@ 2024-08-19 10:23 tzungbi
  2024-08-22 10:11 ` (subset) " Lee Jones
  0 siblings, 1 reply; 2+ messages in thread
From: tzungbi @ 2024-08-19 10:23 UTC (permalink / raw)
  To: lee; +Cc: tzungbi, chrome-platform, linux-kernel

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(-)

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;
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: (subset) [PATCH] mfd: cros_ec: simplify cros_ec_dev_init()
  2024-08-19 10:23 [PATCH] mfd: cros_ec: simplify cros_ec_dev_init() tzungbi
@ 2024-08-22 10:11 ` Lee Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2024-08-22 10:11 UTC (permalink / raw)
  To: lee, tzungbi; +Cc: chrome-platform, linux-kernel

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 [李琼斯]


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-22 10:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-19 10:23 [PATCH] mfd: cros_ec: simplify cros_ec_dev_init() tzungbi
2024-08-22 10:11 ` (subset) " Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox