All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] drivers:adp8870_bl: check the return value of adp8870_write
@ 2022-09-21 21:50 ` Li Zhong
  0 siblings, 0 replies; 4+ messages in thread
From: Li Zhong @ 2022-09-21 21:50 UTC (permalink / raw)
  To: linux-fbdev, dri-devel; +Cc: deller, jingoohan1, daniel.thompson, lee, Li Zhong

Check and propagate the return value of adp8870_write() when it fails,
which is possible when SMBus writing byte fails.

Signed-off-by: Li Zhong <floridsleeves@gmail.com>
---
 drivers/video/backlight/adp8870_bl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers/video/backlight/adp8870_bl.c
index 8b5213a39527..0eb4ae2ff592 100644
--- a/drivers/video/backlight/adp8870_bl.c
+++ b/drivers/video/backlight/adp8870_bl.c
@@ -567,9 +567,13 @@ static ssize_t adp8870_store(struct device *dev, const char *buf,
 		return ret;
 
 	mutex_lock(&data->lock);
-	adp8870_write(data->client, reg, val);
+	ret = adp8870_write(data->client, reg, val);
 	mutex_unlock(&data->lock);
 
+	if (ret) {
+		return ret;
+	}
+
 	return count;
 }
 
-- 
2.25.1


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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-21 21:50 [PATCH v1] drivers:adp8870_bl: check the return value of adp8870_write Li Zhong
2022-09-21 21:50 ` Li Zhong
2022-09-22  9:34 ` Daniel Thompson
2022-09-22  9:34   ` Daniel Thompson

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.