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: <2ecf0bb7-7129-40e4-cefc-0bc2d0f7ee8b@users.sourceforge.net>
Date:   Sun, 22 Oct 2017 22:00:04 +0200
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     dri-devel@...ts.freedesktop.org,
        Andrzej Hajda <a.hajda@...sung.com>,
        Archit Taneja <architt@...eaurora.org>,
        David Airlie <airlied@...ux.ie>,
        Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
        Maciej Purski <m.purski@...sung.com>,
        Rob Herring <robh@...nel.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH v2] gpu/drm/bridge/sii9234: Use common error handling code in
 sii9234_writebm()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sun, 22 Oct 2017 21:50:51 +0200

* Add a jump target so that a bit of exception handling can be better
  reused at the end of this function.

  This issue was detected by using the Coccinelle software.

* Adjust condition checks.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---

v2:
The check for a negative error code was preserved after a call
of the function "i2c_smbus_read_byte".

 drivers/gpu/drm/bridge/sii9234.c | 28 ++++++++++------------------
 1 file changed, 10 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/bridge/sii9234.c b/drivers/gpu/drm/bridge/sii9234.c
index c77000626c22..4d8b2cc29378 100644
--- a/drivers/gpu/drm/bridge/sii9234.c
+++ b/drivers/gpu/drm/bridge/sii9234.c
@@ -231,30 +231,22 @@ static int sii9234_writebm(struct sii9234 *ctx, int id, int offset,
 		return ctx->i2c_error;
 
 	ret = i2c_smbus_write_byte(client, offset);
-	if (ret < 0) {
-		dev_err(ctx->dev, "writebm: %4s[0x%02x] <- 0x%02x\n",
-			sii9234_client_name[id], offset, value);
-		ctx->i2c_error = ret;
-		return ret;
-	}
+	if (ret)
+		goto report_failure;
 
 	ret = i2c_smbus_read_byte(client);
-	if (ret < 0) {
-		dev_err(ctx->dev, "writebm: %4s[0x%02x] <- 0x%02x\n",
-			sii9234_client_name[id], offset, value);
-		ctx->i2c_error = ret;
-		return ret;
-	}
+	if (ret < 0)
+		goto report_failure;
 
 	value = (value & mask) | (ret & ~mask);
-
 	ret = i2c_smbus_write_byte_data(client, offset, value);
-	if (ret < 0) {
-		dev_err(ctx->dev, "writebm: %4s[0x%02x] <- 0x%02x\n",
-			sii9234_client_name[id], offset, value);
-		ctx->i2c_error = ret;
-	}
+	if (!ret)
+		return 0;
 
+report_failure:
+	dev_err(ctx->dev, "writebm: %4s[0x%02x] <- 0x%02x\n",
+		sii9234_client_name[id], offset, value);
+	ctx->i2c_error = ret;
 	return ret;
 }
 
-- 
2.14.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ