lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221114170006.61751-1-andriy.shevchenko@linux.intel.com>
Date:   Mon, 14 Nov 2022 19:00:04 +0200
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>, linux-pwm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc:     Thierry Reding <thierry.reding@...il.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: [PATCH v2 1/2] pwm: core: Refactor pwmchip_add() to avoid extra checks

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@...ux.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ