mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-23 08:35:19 -05:00
mfd: cros_ec: Simplify and clean-up cros_ec_dev_init()
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> Link: https://lore.kernel.org/r/20240819102326.5235-1-tzungbi@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
This commit is contained in:
parent
607638b73c
commit
dc98e25bc3
1 changed files with 3 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue