linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/3] pwm: core: Refactor pwmchip_add() to avoid extra checks
@ 2022-11-01 17:42 Andy Shevchenko
  2022-11-01 17:42 ` [PATCH v1 2/3] pwm: core: Drop unneeded casting in pwm_seq_show() Andy Shevchenko
  2022-11-01 17:42 ` [PATCH v1 3/3] pwm: core: Remove S_IFREG from debugfs_create_file() Andy Shevchenko
  0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2022-11-01 17:42 UTC (permalink / raw)
  To: Uwe Kleine-König, linux-pwm, linux-kernel
  Cc: Thierry Reding, Andy Shevchenko

When we already know that everything is fine there is no need
to use ret variable. Refactor code accordingly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pwm/core.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index d333e7422f4a..855abd0a776f 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -296,16 +296,16 @@ int pwmchip_add(struct pwm_chip *chip)
 	INIT_LIST_HEAD(&chip->list);
 	list_add(&chip->list, &pwm_chips);
 
-	ret = 0;
-
 	if (IS_ENABLED(CONFIG_OF))
 		of_pwmchip_add(chip);
 
-out:
 	mutex_unlock(&pwm_lock);
 
-	if (!ret)
-		pwmchip_sysfs_export(chip);
+	pwmchip_sysfs_export(chip);
+
+	return 0;
+out:
+	mutex_unlock(&pwm_lock);
 
 	return ret;
 }
-- 
2.35.1


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

end of thread, other threads:[~2022-11-01 20:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-01 17:42 [PATCH v1 1/3] pwm: core: Refactor pwmchip_add() to avoid extra checks Andy Shevchenko
2022-11-01 17:42 ` [PATCH v1 2/3] pwm: core: Drop unneeded casting in pwm_seq_show() Andy Shevchenko
2022-11-01 17:47   ` Andy Shevchenko
2022-11-01 20:53   ` kernel test robot
2022-11-01 17:42 ` [PATCH v1 3/3] pwm: core: Remove S_IFREG from debugfs_create_file() Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).