diff mbox

drm/panel: rpi-touchscreen: propagate errors in rpi_touchscreen_i2c_read()

Message ID 20171020002845.kar2wg7gqxg7tzqi@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter Oct. 20, 2017, 12:28 a.m. UTC
There is one caller which checks whether rpi_touchscreen_i2c_read()
returns negative error codes.  Currently it can't because negative
error codes are truncated to u8, but that's easy to fix if we change the
type to int.

Fixes: 2f733d6194bd ("drm/panel: Add support for the Raspberry Pi 7" Touchscreen.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Eric Anholt Oct. 31, 2017, 12:02 a.m. UTC | #1
Dan Carpenter <dan.carpenter@oracle.com> writes:

> There is one caller which checks whether rpi_touchscreen_i2c_read()
> returns negative error codes.  Currently it can't because negative
> error codes are truncated to u8, but that's easy to fix if we change the
> type to int.

Reviewed and applied to -next.  Thanks!

(Not to -fixes because we're late in the cycle, we don't have an
upstream DT exposing the panel, and it seems unlikely that the error
value here would happen to collide with one of the 2 values of a valid
firmware revision)
diff mbox

Patch

diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
index 890fd6ff397c..d964d454e4ae 100644
--- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
+++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
@@ -221,7 +221,7 @@  static struct rpi_touchscreen *panel_to_ts(struct drm_panel *panel)
 	return container_of(panel, struct rpi_touchscreen, base);
 }
 
-static u8 rpi_touchscreen_i2c_read(struct rpi_touchscreen *ts, u8 reg)
+static int rpi_touchscreen_i2c_read(struct rpi_touchscreen *ts, u8 reg)
 {
 	return i2c_smbus_read_byte_data(ts->i2c, reg);
 }