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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <568ee0ee-8ff1-9739-fa6b-f2eeae53e11a@users.sourceforge.net>
Date:   Fri, 27 Oct 2017 18:20:02 +0200
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     kernel-janitors@...r.kernel.org,
        Andrew Morton <akpm@...ux-foundation.org>,
        Arnd Bergmann <arnd@...db.de>,
        Dan Carpenter <dan.carpenter@...cle.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Jonathan Cameron <jic23@...nel.org>,
        Samu Onkalo <samu.p.onkalo@...ia.com>
Subject: [PATCH] misc: bh1770glc: Use common error handling code in
 bh1770_power_state_store()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Fri, 27 Oct 2017 18:00:31 +0200

Adjust jump targets so that a bit of exception handling can be better
reused in an if branch of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/misc/bh1770glc.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/misc/bh1770glc.c b/drivers/misc/bh1770glc.c
index 9c62bf064f77..c4c108ed88b0 100644
--- a/drivers/misc/bh1770glc.c
+++ b/drivers/misc/bh1770glc.c
@@ -660,15 +660,14 @@ static ssize_t bh1770_power_state_store(struct device *dev,
 		pm_runtime_get_sync(dev);
 
 		ret = bh1770_lux_rate(chip, chip->lux_rate_index);
-		if (ret < 0) {
-			pm_runtime_put(dev);
-			goto leave;
-		}
+		if (ret < 0)
+			goto put_runtime;
 
 		ret = bh1770_lux_interrupt_control(chip, BH1770_ENABLE);
 		if (ret < 0) {
+put_runtime:
 			pm_runtime_put(dev);
-			goto leave;
+			goto unlock;
 		}
 
 		/* This causes interrupt after the next measurement cycle */
@@ -681,7 +680,7 @@ static ssize_t bh1770_power_state_store(struct device *dev,
 		pm_runtime_put(dev);
 	}
 	ret = count;
-leave:
+unlock:
 	mutex_unlock(&chip->mutex);
 	return ret;
 }
-- 
2.14.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ