All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] touchscreen/88pm860x-ts: check the pm860x_set_bits return value
@ 2022-09-21 20:37 Li Zhong
  2022-09-21 22:47 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Li Zhong @ 2022-09-21 20:37 UTC (permalink / raw)
  To: linux-input; +Cc: dmitry.torokhov, Li Zhong

pm860x_touch_close() got the return value of pm860x_set_bits() but
didn't check it. However, pm860x_set_bits() could fail when writing the
reg map fails. Since pm860x_touch_close() cannot return an error value,
we retry the bit setting in the error handling.

Signed-off-by: Li Zhong <floridsleeves@gmail.com>
---
 drivers/input/touchscreen/88pm860x-ts.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/88pm860x-ts.c b/drivers/input/touchscreen/88pm860x-ts.c
index 81a3ea4b9a3d..043520d1ff26 100644
--- a/drivers/input/touchscreen/88pm860x-ts.c
+++ b/drivers/input/touchscreen/88pm860x-ts.c
@@ -106,10 +106,13 @@ static void pm860x_touch_close(struct input_dev *dev)
 {
 	struct pm860x_touch *touch = input_get_drvdata(dev);
 	int data;
+	int ret;
 
 	data = MEAS_PD_EN | MEAS_TSIX_EN | MEAS_TSIY_EN
 		| MEAS_TSIZ1_EN | MEAS_TSIZ2_EN;
-	pm860x_set_bits(touch->i2c, MEAS_EN3, data, 0);
+	ret = pm860x_set_bits(touch->i2c, MEAS_EN3, data, 0);
+	if (ret < 0)
+		pm860x_set_bits(touch->i2c, MEAS_EN3, data, 0);
 }
 
 #ifdef CONFIG_OF
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-21 22:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-21 20:37 [PATCH v1] touchscreen/88pm860x-ts: check the pm860x_set_bits return value Li Zhong
2022-09-21 22:47 ` Dmitry Torokhov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.