soundwire: Fix incorrect return value check
authorShreyas NC <shreyas.nc@intel.com>
Tue, 9 Jan 2018 04:45:46 +0000 (10:15 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Jan 2018 16:01:16 +0000 (17:01 +0100)
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>
drivers/soundwire/bus.c

index 03313590b661e87b61f6fee84ed4f45935938ba7..5d7226c251e69b33ddec69c66de9657d10043fa7 100644 (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);