summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-01-21 05:56:31 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-01-22 16:45:26 +0100
commit51c266561e5aec056e025b5bf9072d82c89b59b3 (patch)
tree9e3bb63ff4e24eda044a5f3deae9ad37d0cc7955 /drivers
parentuio_hv_generic: fix new type mismatch warnings (diff)
downloadlinux-51c266561e5aec056e025b5bf9072d82c89b59b3.tar.xz
linux-51c266561e5aec056e025b5bf9072d82c89b59b3.zip
soundwire: Fix a signedness bug
"ret" is an int and "buf" is a u8. sdw_read() returns negative error codes which are truncated to the u8, 0-255 range before being stored as an int. It means that "ret" can't be less than zero. Fixes: b0a9c37b0178 ("soundwire: Add slave status handling") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/soundwire/bus.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index 5d7226c251e6..d6dc8e7a8614 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -771,7 +771,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
sdw_modify_slave_status(slave, SDW_SLAVE_ALERT);
/* Read Instat 1, Instat 2 and Instat 3 registers */
- ret = buf = sdw_read(slave, SDW_SCP_INT1);
+ buf = ret = sdw_read(slave, SDW_SCP_INT1);
if (ret < 0) {
dev_err(slave->bus->dev,
"SDW_SCP_INT1 read failed:%d", ret);
@@ -870,7 +870,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
* Read status again to ensure no new interrupts arrived
* while servicing interrupts.
*/
- ret = _buf = sdw_read(slave, SDW_SCP_INT1);
+ _buf = ret = sdw_read(slave, SDW_SCP_INT1);
if (ret < 0) {
dev_err(slave->bus->dev,
"SDW_SCP_INT1 read failed:%d", ret);