From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Thierry Reding <thierry.reding@gmail.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v2 1/2] pwm: core: Refactor pwmchip_add() to avoid extra checks
Date: Mon, 14 Nov 2022 19:00:04 +0200 [thread overview]
Message-ID: <20221114170006.61751-1-andriy.shevchenko@linux.intel.com> (raw)
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>
---
v2: rebased with dropped wrong patch (LKP)
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
next reply other threads:[~2022-11-14 17:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-14 17:00 Andy Shevchenko [this message]
2022-11-14 17:00 ` [PATCH v2 2/2] pwm: core: Remove S_IFREG from debugfs_create_file() Andy Shevchenko
2022-11-15 20:24 ` [PATCH v2 1/2] pwm: core: Refactor pwmchip_add() to avoid extra checks Uwe Kleine-König
2022-11-16 8:22 ` Andy Shevchenko
2022-11-17 13:54 ` Uwe Kleine-König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221114170006.61751-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=thierry.reding@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.