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: <20220106071316.2691138-1-jiasheng@iscas.ac.cn>
Date:   Thu,  6 Jan 2022 15:13:16 +0800
From:   Jiasheng Jiang <jiasheng@...as.ac.cn>
To:     eric.piel@...mplin-utc.net, arnd@...db.de,
        gregkh@...uxfoundation.org
Cc:     linux-kernel@...r.kernel.org, Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] drivers/misc/lis3lv02d/lis3lv02d_i2c.c: Check for error return from regulator_bulk_enable in lis3lv02d_i2c_probe

Because of the possible failure of the consumer, the
regulator_bulk_enable() may return error.
Therefore, it should be better to check the return value of the
lis3_reg_ctrl() and return error if fails.

Fixes: ec400c9fab99 ("lis3lv02d: make regulator API usage unconditional")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
 drivers/misc/lis3lv02d/lis3lv02d_i2c.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/lis3lv02d/lis3lv02d_i2c.c b/drivers/misc/lis3lv02d/lis3lv02d_i2c.c
index 4001e3c0a167..4fe5ff8cacb8 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d_i2c.c
+++ b/drivers/misc/lis3lv02d/lis3lv02d_i2c.c
@@ -105,7 +105,7 @@ MODULE_DEVICE_TABLE(of, lis3lv02d_i2c_dt_ids);
 static int lis3lv02d_i2c_probe(struct i2c_client *client,
 					const struct i2c_device_id *id)
 {
-	int ret = 0;
+	int ret = 0, err;
 	struct lis3lv02d_platform_data *pdata = client->dev.platform_data;
 
 #ifdef CONFIG_OF
@@ -160,11 +160,19 @@ static int lis3lv02d_i2c_probe(struct i2c_client *client,
 	i2c_set_clientdata(client, &lis3_dev);
 
 	/* Provide power over the init call */
-	lis3_reg_ctrl(&lis3_dev, LIS3_REG_ON);
+	err = lis3_reg_ctrl(&lis3_dev, LIS3_REG_ON);
+	if (err) {
+		ret = err;
+		goto fail2;
+	}
 
 	ret = lis3lv02d_init_device(&lis3_dev);
 
-	lis3_reg_ctrl(&lis3_dev, LIS3_REG_OFF);
+	err = lis3_reg_ctrl(&lis3_dev, LIS3_REG_OFF);
+	if (err) {
+		ret = err;
+		goto fail2;
+	}
 
 	if (ret)
 		goto fail2;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ