platform/chrome: cros_ec: remove unneeded label and if-condition
Subsystems (2)
Tzung-Bi Shih
maintainerPATCH 1/1 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.
--- drivers/platform/chrome/cros_ec.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/platform/chrome/cros_ec.c +4 -6
@@ -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);
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
Quoted 8 lines · Tzung-Bi Shih
Both
ec_dev->ecandec_dev->pdare initialized to NULL at the beginning ofcros_ec_register(). Also,platform_device_unregister()takes care if the givenplatform_deviceis NULL.Remove the unneeded goto-label and if-condition.
Signed-off-by Tzung-Bi Shih <[email protected]>
Quoted 56 lines
--- drivers/platform/chrome/cros_ec.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)drivers/platform/chrome/cros_ec.c +4
-7@@ -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); --2.40.0.rc1.284.g88254d51c5-goog
This patch was applied to chrome-platform/linux.git (for-kernelci) by Tzung-Bi Shih <[email protected]>:
Hello:
This patch was applied to chrome-platform/linux.git (for-kernelci) by Tzung-Bi Shih <[email protected]>:
Quoted 9 lines · On Wed, 8 Mar 2023 11:12:47 +0800 you wrote:
Both
ec_dev->ecandec_dev->pdare initialized to NULL at the beginning ofcros_ec_register(). Also,platform_device_unregister()takes care if the givenplatform_deviceis NULL.Remove the unneeded goto-label and if-condition.
Signed-off-by Tzung-Bi Shih <[email protected]>[...]
Here is the summary with links:
- platform/chrome: cros_ec: remove unneeded label and if-condition
https://git.kernel.org/chrome-platform/c/db7df0cfaff3
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
This patch was applied to chrome-platform/linux.git (for-next) by Tzung-Bi Shih <[email protected]>:
Hello:
This patch was applied to chrome-platform/linux.git (for-next) by Tzung-Bi Shih <[email protected]>:
Quoted 9 lines · On Wed, 8 Mar 2023 11:12:47 +0800 you wrote:
Both
ec_dev->ecandec_dev->pdare initialized to NULL at the beginning ofcros_ec_register(). Also,platform_device_unregister()takes care if the givenplatform_deviceis NULL.Remove the unneeded goto-label and if-condition.
Signed-off-by Tzung-Bi Shih <[email protected]>[...]
Here is the summary with links:
- platform/chrome: cros_ec: remove unneeded label and if-condition
https://git.kernel.org/chrome-platform/c/db7df0cfaff3
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html