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: <20220928084709.1822312-1-potin.lai.pt@gmail.com>
Date:   Wed, 28 Sep 2022 16:47:09 +0800
From:   Potin Lai <potin.lai.pt@...il.com>
To:     Pavel Machek <pavel@....cz>
Cc:     linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org,
        Joel Stanley <joel@....id.au>,
        Patrick Williams <patrick@...cx.xyz>,
        Potin Lai <potin.lai@...ntatw.com>,
        Potin Lai <potin.lai.pt@...il.com>
Subject: [PATCH 1/1] leds: pca955x: fix return value checking of smbus block read

In i2c_smbus_read_i2c_block_data(), it returns negtive value for error
code, otherwise returns data length of reading.
Change the if statement to "if (err < 0)" to indicate the real error
returned by i2c_smbus_read_i2c_block_data().

Signed-off-by: Potin Lai <potin.lai.pt@...il.com>
---
 drivers/leds/leds-pca955x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c
index cf0a9fe20086a..cba9876b11872 100644
--- a/drivers/leds/leds-pca955x.c
+++ b/drivers/leds/leds-pca955x.c
@@ -689,7 +689,7 @@ static int pca955x_probe(struct i2c_client *client)
 	err = i2c_smbus_read_i2c_block_data(client,
 					    0x10 | (pca955x_num_input_regs(chip->bits) + 4), nls,
 					    ls1);
-	if (err)
+	if (err < 0)
 		return err;
 
 	for (i = 0; i < nls; ++i)
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ