diff options
author | Tzung-Bi Shih <tzungbi@kernel.org> | 2023-03-08 06:12:47 +0300 |
---|---|---|
committer | Tzung-Bi Shih <tzungbi@kernel.org> | 2023-04-24 08:35:11 +0300 |
commit | 554ec02c97254962bbb0a8776c3160d294fc7e51 (patch) | |
tree | 2a8d5b0df4f8074d7d4f6f797053603e23e7b534 /drivers/platform | |
parent | 32d2a15ec54a3d8b708b343e50072ccb0e5da83f (diff) | |
download | linux-554ec02c97254962bbb0a8776c3160d294fc7e51.tar.xz |
platform/chrome: cros_ec: remove unneeded label and if-condition
Both `ec_dev->ec` and `ec_dev->pd` are initialized to NULL at the
beginning of cros_ec_register(). Also, platform_device_unregister()
takes care if the given platform_device is NULL.
Remove the unneeded goto-label and if-condition.
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Link: https://lore.kernel.org/r/20230308031247.2866401-1-tzungbi@kernel.org
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/chrome/cros_ec.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c index b895c8130bba..8b7949220382 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -206,7 +206,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev) err = cros_ec_query_all(ec_dev); if (err) { dev_err(dev, "Cannot identify the EC: error %d\n", err); - goto destroy_mutex; + goto exit; } if (ec_dev->irq > 0) { @@ -218,7 +218,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev) if (err) { dev_err(dev, "Failed to request IRQ %d: %d\n", ec_dev->irq, err); - goto destroy_mutex; + goto exit; } } @@ -230,7 +230,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev) dev_err(ec_dev->dev, "Failed to create CrOS EC platform device\n"); err = PTR_ERR(ec_dev->ec); - goto destroy_mutex; + goto exit; } if (ec_dev->max_passthru) { @@ -296,7 +296,6 @@ int cros_ec_register(struct cros_ec_device *ec_dev) exit: platform_device_unregister(ec_dev->ec); platform_device_unregister(ec_dev->pd); -destroy_mutex: mutex_destroy(&ec_dev->lock); lockdep_unregister_key(&ec_dev->lockdep_key); return err; @@ -313,8 +312,7 @@ EXPORT_SYMBOL(cros_ec_register); */ void cros_ec_unregister(struct cros_ec_device *ec_dev) { - if (ec_dev->pd) - platform_device_unregister(ec_dev->pd); + platform_device_unregister(ec_dev->pd); platform_device_unregister(ec_dev->ec); mutex_destroy(&ec_dev->lock); lockdep_unregister_key(&ec_dev->lockdep_key); |