Commit a5759f19 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Vinod Koul

soundwire: bus: use consistent tests for return values

We use different styles to check the return values of IO related
routines. The majority of the cases use 'if (ret < 0)', align the
remaining cases for consistency.
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarGuennadi Liakhovetski <guennadi.liakhovetski@intel.com>
Reviewed-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: default avatarGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20210302091122.13952-4-yung-chuan.liao@linux.intel.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 665cf215
...@@ -44,13 +44,13 @@ int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent, ...@@ -44,13 +44,13 @@ int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent,
} }
ret = sdw_get_id(bus); ret = sdw_get_id(bus);
if (ret) { if (ret < 0) {
dev_err(parent, "Failed to get bus id\n"); dev_err(parent, "Failed to get bus id\n");
return ret; return ret;
} }
ret = sdw_master_device_add(bus, parent, fwnode); ret = sdw_master_device_add(bus, parent, fwnode);
if (ret) { if (ret < 0) {
dev_err(parent, "Failed to add master device at link %d\n", dev_err(parent, "Failed to add master device at link %d\n",
bus->link_id); bus->link_id);
return ret; return ret;
...@@ -121,7 +121,7 @@ int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent, ...@@ -121,7 +121,7 @@ int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent,
else else
ret = -ENOTSUPP; /* No ACPI/DT so error out */ ret = -ENOTSUPP; /* No ACPI/DT so error out */
if (ret) { if (ret < 0) {
dev_err(bus->dev, "Finding slaves failed:%d\n", ret); dev_err(bus->dev, "Finding slaves failed:%d\n", ret);
return ret; return ret;
} }
...@@ -422,7 +422,7 @@ sdw_bread_no_pm(struct sdw_bus *bus, u16 dev_num, u32 addr) ...@@ -422,7 +422,7 @@ sdw_bread_no_pm(struct sdw_bus *bus, u16 dev_num, u32 addr)
ret = sdw_fill_msg(&msg, NULL, addr, 1, dev_num, ret = sdw_fill_msg(&msg, NULL, addr, 1, dev_num,
SDW_MSG_FLAG_READ, &buf); SDW_MSG_FLAG_READ, &buf);
if (ret) if (ret < 0)
return ret; return ret;
ret = sdw_transfer(bus, &msg); ret = sdw_transfer(bus, &msg);
...@@ -440,7 +440,7 @@ sdw_bwrite_no_pm(struct sdw_bus *bus, u16 dev_num, u32 addr, u8 value) ...@@ -440,7 +440,7 @@ sdw_bwrite_no_pm(struct sdw_bus *bus, u16 dev_num, u32 addr, u8 value)
ret = sdw_fill_msg(&msg, NULL, addr, 1, dev_num, ret = sdw_fill_msg(&msg, NULL, addr, 1, dev_num,
SDW_MSG_FLAG_WRITE, &value); SDW_MSG_FLAG_WRITE, &value);
if (ret) if (ret < 0)
return ret; return ret;
return sdw_transfer(bus, &msg); return sdw_transfer(bus, &msg);
...@@ -454,7 +454,7 @@ int sdw_bread_no_pm_unlocked(struct sdw_bus *bus, u16 dev_num, u32 addr) ...@@ -454,7 +454,7 @@ int sdw_bread_no_pm_unlocked(struct sdw_bus *bus, u16 dev_num, u32 addr)
ret = sdw_fill_msg(&msg, NULL, addr, 1, dev_num, ret = sdw_fill_msg(&msg, NULL, addr, 1, dev_num,
SDW_MSG_FLAG_READ, &buf); SDW_MSG_FLAG_READ, &buf);
if (ret) if (ret < 0)
return ret; return ret;
ret = sdw_transfer_unlocked(bus, &msg); ret = sdw_transfer_unlocked(bus, &msg);
...@@ -472,7 +472,7 @@ int sdw_bwrite_no_pm_unlocked(struct sdw_bus *bus, u16 dev_num, u32 addr, u8 val ...@@ -472,7 +472,7 @@ int sdw_bwrite_no_pm_unlocked(struct sdw_bus *bus, u16 dev_num, u32 addr, u8 val
ret = sdw_fill_msg(&msg, NULL, addr, 1, dev_num, ret = sdw_fill_msg(&msg, NULL, addr, 1, dev_num,
SDW_MSG_FLAG_WRITE, &value); SDW_MSG_FLAG_WRITE, &value);
if (ret) if (ret < 0)
return ret; return ret;
return sdw_transfer_unlocked(bus, &msg); return sdw_transfer_unlocked(bus, &msg);
...@@ -749,7 +749,7 @@ static int sdw_program_device_num(struct sdw_bus *bus) ...@@ -749,7 +749,7 @@ static int sdw_program_device_num(struct sdw_bus *bus)
* dev_num * dev_num
*/ */
ret = sdw_assign_device_num(slave); ret = sdw_assign_device_num(slave);
if (ret) { if (ret < 0) {
dev_err(bus->dev, dev_err(bus->dev,
"Assign dev_num failed:%d\n", "Assign dev_num failed:%d\n",
ret); ret);
...@@ -886,7 +886,7 @@ static int sdw_slave_clk_stop_prepare(struct sdw_slave *slave, ...@@ -886,7 +886,7 @@ static int sdw_slave_clk_stop_prepare(struct sdw_slave *slave,
ret = sdw_write_no_pm(slave, SDW_SCP_SYSTEMCTRL, val); ret = sdw_write_no_pm(slave, SDW_SCP_SYSTEMCTRL, val);
if (ret != 0) if (ret < 0)
dev_err(&slave->dev, dev_err(&slave->dev,
"Clock Stop prepare failed for slave: %d", ret); "Clock Stop prepare failed for slave: %d", ret);
...@@ -1748,7 +1748,7 @@ int sdw_handle_slave_status(struct sdw_bus *bus, ...@@ -1748,7 +1748,7 @@ int sdw_handle_slave_status(struct sdw_bus *bus,
if (status[0] == SDW_SLAVE_ATTACHED) { if (status[0] == SDW_SLAVE_ATTACHED) {
dev_dbg(bus->dev, "Slave attached, programming device number\n"); dev_dbg(bus->dev, "Slave attached, programming device number\n");
ret = sdw_program_device_num(bus); ret = sdw_program_device_num(bus);
if (ret) if (ret < 0)
dev_err(bus->dev, "Slave attach failed: %d\n", ret); dev_err(bus->dev, "Slave attach failed: %d\n", ret);
/* /*
* programming a device number will have side effects, * programming a device number will have side effects,
...@@ -1782,7 +1782,7 @@ int sdw_handle_slave_status(struct sdw_bus *bus, ...@@ -1782,7 +1782,7 @@ int sdw_handle_slave_status(struct sdw_bus *bus,
case SDW_SLAVE_ALERT: case SDW_SLAVE_ALERT:
ret = sdw_handle_slave_alerts(slave); ret = sdw_handle_slave_alerts(slave);
if (ret) if (ret < 0)
dev_err(&slave->dev, dev_err(&slave->dev,
"Slave %d alert handling failed: %d\n", "Slave %d alert handling failed: %d\n",
i, ret); i, ret);
...@@ -1801,7 +1801,7 @@ int sdw_handle_slave_status(struct sdw_bus *bus, ...@@ -1801,7 +1801,7 @@ int sdw_handle_slave_status(struct sdw_bus *bus,
attached_initializing = true; attached_initializing = true;
ret = sdw_initialize_slave(slave); ret = sdw_initialize_slave(slave);
if (ret) if (ret < 0)
dev_err(&slave->dev, dev_err(&slave->dev,
"Slave %d initialization failed: %d\n", "Slave %d initialization failed: %d\n",
i, ret); i, ret);
...@@ -1815,7 +1815,7 @@ int sdw_handle_slave_status(struct sdw_bus *bus, ...@@ -1815,7 +1815,7 @@ int sdw_handle_slave_status(struct sdw_bus *bus,
} }
ret = sdw_update_slave_status(slave, status[i]); ret = sdw_update_slave_status(slave, status[i]);
if (ret) if (ret < 0)
dev_err(&slave->dev, dev_err(&slave->dev,
"Update Slave status failed:%d\n", ret); "Update Slave status failed:%d\n", ret);
if (attached_initializing) { if (attached_initializing) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment