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 <shreyas.nc@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 9d715fa005eb: ("soundwire: Add IO transfer")
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Shreyas NC 2018-01-09 10:15:46 +05:30 committed by Greg Kroah-Hartman
parent ba60eb1934
commit c22c0ae523
1 changed files with 2 additions and 2 deletions

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);