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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0f26a13b-7bbf-525b-a864-8aa8e13c3aef@users.sourceforge.net>
Date:   Wed, 25 Oct 2017 22:16:31 +0200
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     linux-iio@...r.kernel.org, Hartmut Knaack <knaack.h@....de>,
        Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>,
        Tiberiu Breana <tiberiu.a.breana@...el.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH 1/2] iio/accel/stk8ba50: Use common error handling code in
 stk8ba50_probe()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Wed, 25 Oct 2017 21:36:03 +0200

* Add a jump target so that a specific error message is stored only once
  at the end of this function implementation.

* Replace two calls of the function "dev_err" by goto statements.

* Adjust condition checks.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/iio/accel/stk8ba50.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/accel/stk8ba50.c b/drivers/iio/accel/stk8ba50.c
index 576b6b140f08..afe90567ad37 100644
--- a/drivers/iio/accel/stk8ba50.c
+++ b/drivers/iio/accel/stk8ba50.c
@@ -426,16 +426,13 @@ static int stk8ba50_probe(struct i2c_client *client,
 	/* Set up interrupts */
 	ret = i2c_smbus_write_byte_data(client,
 			STK8BA50_REG_INTEN2, STK8BA50_DREADY_INT_MASK);
-	if (ret < 0) {
-		dev_err(&client->dev, "failed to set up interrupts\n");
-		goto err_power_off;
-	}
+	if (ret)
+		goto report_failure;
+
 	ret = i2c_smbus_write_byte_data(client,
 			STK8BA50_REG_INTMAP2, STK8BA50_DREADY_INT_MAP);
-	if (ret < 0) {
-		dev_err(&client->dev, "failed to set up interrupts\n");
-		goto err_power_off;
-	}
+	if (ret)
+		goto report_failure;
 
 	if (client->irq > 0) {
 		ret = devm_request_threaded_irq(&client->dev, client->irq,
@@ -495,6 +492,10 @@ static int stk8ba50_probe(struct i2c_client *client,
 err_power_off:
 	stk8ba50_set_power(data, STK8BA50_MODE_SUSPEND);
 	return ret;
+
+report_failure:
+	dev_err(&client->dev, "failed to set up interrupts\n");
+	goto err_power_off;
 }
 
 static int stk8ba50_remove(struct i2c_client *client)
-- 
2.14.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ