[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220106065657.2667748-1-jiasheng@iscas.ac.cn>
Date: Thu, 6 Jan 2022 14:56:57 +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 lis3_i2c_init
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().
There are two callers, and I submit two patches to fix separately.
This patch is about lis3_i2c_init().
Fixes: ec400c9fab99 ("lis3lv02d: make regulator API usage unconditional")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
drivers/misc/lis3lv02d/lis3lv02d_i2c.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/lis3lv02d/lis3lv02d_i2c.c b/drivers/misc/lis3lv02d/lis3lv02d_i2c.c
index 52555d2e824b..4001e3c0a167 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d_i2c.c
+++ b/drivers/misc/lis3lv02d/lis3lv02d_i2c.c
@@ -69,7 +69,9 @@ static int lis3_i2c_init(struct lis3lv02d *lis3)
u8 reg;
int ret;
- lis3_reg_ctrl(lis3, LIS3_REG_ON);
+ ret = lis3_reg_ctrl(lis3, LIS3_REG_ON);
+ if (ret)
+ return ret;
lis3->read(lis3, WHO_AM_I, ®);
if (reg != lis3->whoami)
--
2.25.1
Powered by blists - more mailing lists