mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-07 13:53:24 +00:00
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: b0a9c37b01
("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>
This commit is contained in:
parent
d6088e9a89
commit
51c266561e
@ -771,7 +771,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
|
|||||||
sdw_modify_slave_status(slave, SDW_SLAVE_ALERT);
|
sdw_modify_slave_status(slave, SDW_SLAVE_ALERT);
|
||||||
|
|
||||||
/* Read Instat 1, Instat 2 and Instat 3 registers */
|
/* 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) {
|
if (ret < 0) {
|
||||||
dev_err(slave->bus->dev,
|
dev_err(slave->bus->dev,
|
||||||
"SDW_SCP_INT1 read failed:%d", ret);
|
"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
|
* Read status again to ensure no new interrupts arrived
|
||||||
* while servicing interrupts.
|
* while servicing interrupts.
|
||||||
*/
|
*/
|
||||||
ret = _buf = sdw_read(slave, SDW_SCP_INT1);
|
_buf = ret = sdw_read(slave, SDW_SCP_INT1);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(slave->bus->dev,
|
dev_err(slave->bus->dev,
|
||||||
"SDW_SCP_INT1 read failed:%d", ret);
|
"SDW_SCP_INT1 read failed:%d", ret);
|
||||||
|
Loading…
Reference in New Issue
Block a user