Skip to contentSkip to conversation

soundwire: bus: provide correct return value on error

PATCH Superseded Pierre-Louis Bossart 2 participants 3 messages Feb 25, 2020 – Feb 26, 2020 SoundWire

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 soundwire: bus: provide correct return value on error

From: Bard Liao <[email protected]>

It seems to be a typo. It makes more sense to return the return value of sdw_update() instead of the value we want to update.

---
 drivers/soundwire/bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soundwire/bus.c +1 -1
index 13887713f311..b8a7a84aca1c 100644
@@ -1070,7 +1070,7 @@ static int sdw_initialize_slave(struct sdw_slave *slave)
 	if (ret < 0) {
 		dev_err(slave->bus->dev,
 			"SDW_DP0_INTMASK read failed:%d\n", ret);
-		return val;
+		return ret;
 	}
 
 	return 0;
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 16 lines · Pierre-Louis Bossart

From: Bard Liao <[email protected]>

It seems to be a typo. It makes more sense to return the return value of sdw_update() instead of the value we want to update.

---
 drivers/soundwire/bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soundwire/bus.c +0 -0
index 13887713f311..b8a7a84aca1c 100644

drivers/soundwire/bus.c static int sdw_initialize_slave(struct sdw_slave *slave) · line 1073

Quoted 5 lines
drivers/soundwire/bus.c +1 -1
@@ -1070,7 +1070,7 @@ static int sdw_initialize_slave(struct sdw_slave *slave)
 	if (ret < 0) {
 		dev_err(slave->bus->dev,
 			"SDW_DP0_INTMASK read failed:%d\n", ret);
-		return val;
+		return ret;

good catch. But can we optimize it to:

drivers/soundwire/bus.c static int sdw_initialize_slave(struct sdw_slave *slave) · line 1076

Quoted 3 lines
drivers/soundwire/bus.c +0 -0
 	}
 
 	return 0;

make this as below and remove the return above.

        return ret;
Quoted 2 lines
Signature · 1 line
2.20.1
Signature · 1 line
~Vinod
#2 lore raw
Quoted 24 lines · Vinod Koul
Quoted 16 lines · Pierre-Louis Bossart

From: Bard Liao <[email protected]>

It seems to be a typo. It makes more sense to return the return value of sdw_update() instead of the value we want to update.

---
  drivers/soundwire/bus.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soundwire/bus.c +0 -0
index 13887713f311..b8a7a84aca1c 100644

drivers/soundwire/bus.c static int sdw_initialize_slave(struct sdw_slave *slave) · line 1073

Quoted 5 lines
drivers/soundwire/bus.c +1 -1
@@ -1070,7 +1070,7 @@ static int sdw_initialize_slave(struct sdw_slave *slave)
  	if (ret < 0) {
  		dev_err(slave->bus->dev,
  			"SDW_DP0_INTMASK read failed:%d\n", ret);
-		return val;
+		return ret;

good catch. But can we optimize it to:

Quoted 5 lines

drivers/soundwire/bus.c static int sdw_initialize_slave(struct sdw_slave *slave) · line 1076

Quoted 3 lines
drivers/soundwire/bus.c +0 -0
  	}
 
  	return 0;

make this as below and remove the return above.

ok, will resend as v2.