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>] [day] [month] [year] [list]
Message-Id: <20190226092334.30646-1-oded.gabbay@gmail.com>
Date:   Tue, 26 Feb 2019 11:23:34 +0200
From:   Oded Gabbay <oded.gabbay@...il.com>
To:     gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
        dan.carpenter@...cle.com, rppt@...ux.ibm.com
Subject: [PATCH] habanalabs: return error when failing to read/write i2c

The driver can't read/write from i2c if the device is in reset or
disabled. Therefore, return -EBUSY in those cases instead of 0.

This change also fixes a smatch warning about uninitialized variable.

Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Oded Gabbay <oded.gabbay@...il.com>
---
 drivers/misc/habanalabs/debugfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/habanalabs/debugfs.c b/drivers/misc/habanalabs/debugfs.c
index a6d9d809385e..f472b572faea 100644
--- a/drivers/misc/habanalabs/debugfs.c
+++ b/drivers/misc/habanalabs/debugfs.c
@@ -25,7 +25,7 @@ static int hl_debugfs_i2c_read(struct hl_device *hdev, u8 i2c_bus, u8 i2c_addr,
 	int rc;
 
 	if (hl_device_disabled_or_in_reset(hdev))
-		return 0;
+		return -EBUSY;
 
 	memset(&pkt, 0, sizeof(pkt));
 
@@ -50,7 +50,7 @@ static int hl_debugfs_i2c_write(struct hl_device *hdev, u8 i2c_bus, u8 i2c_addr,
 	int rc;
 
 	if (hl_device_disabled_or_in_reset(hdev))
-		return 0;
+		return -EBUSY;
 
 	memset(&pkt, 0, sizeof(pkt));
 
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ