soundwire: Fix incorrect return value check

pm_runtime_get_sync will return negative values for error
and 0 or 1 for success. Update the error check accordingly.

Signed-off-by: Shreyas NC <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Fixes: 9d715fa005: ("soundwire: Add IO transfer")
Signed-off-by: Vinod Koul <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
Shreyas NC 2018-01-09 10:15:46 +05:30 • committed by Greg Kroah-Hartman
commit c22c0ae523

View file

@ -305,7 +305,7 @@ int sdw_nread(struct sdw_slave *slave, u32 addr, size_t count, u8 *val)
return ret;
ret = pm_runtime_get_sync(slave->bus->dev);
if (!ret)
if (ret < 0)
return ret;
ret = sdw_transfer(slave->bus, &msg);
@ -333,7 +333,7 @@ int sdw_nwrite(struct sdw_slave *slave, u32 addr, size_t count, u8 *val)
return ret;
ret = pm_runtime_get_sync(slave->bus->dev);
if (!ret)
if (ret < 0)
return ret;
ret = sdw_transfer(slave->bus, &msg);