soundwire: bus: provide correct return value on error
diff mbox series

Message ID 20200225164907.23358-1-pierre-louis.bossart@linux.intel.com
State New
Headers show
Series
  • soundwire: bus: provide correct return value on error
Related show

Commit Message

Pierre-Louis Bossart Feb. 25, 2020, 4:49 p.m. UTC
From: Bard Liao <yung-chuan.liao@linux.intel.com>

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.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 drivers/soundwire/bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Vinod Koul Feb. 26, 2020, 8:03 a.m. UTC | #1
On 25-02-20, 10:49, Pierre-Louis Bossart wrote:
> From: Bard Liao <yung-chuan.liao@linux.intel.com>
> 
> 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.
> 
> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
>  drivers/soundwire/bus.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
> index 13887713f311..b8a7a84aca1c 100644
> --- a/drivers/soundwire/bus.c
> +++ b/drivers/soundwire/bus.c
> @@ -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:
>  	}
>  
>  	return 0;

make this as below and remove the return above.

        return ret;
> -- 
> 2.20.1
Pierre-Louis Bossart Feb. 26, 2020, 2:54 p.m. UTC | #2
On 2/26/20 2:03 AM, Vinod Koul wrote:
> On 25-02-20, 10:49, Pierre-Louis Bossart wrote:
>> From: Bard Liao <yung-chuan.liao@linux.intel.com>
>>
>> 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.
>>
>> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
>> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
>> ---
>>   drivers/soundwire/bus.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
>> index 13887713f311..b8a7a84aca1c 100644
>> --- a/drivers/soundwire/bus.c
>> +++ b/drivers/soundwire/bus.c
>> @@ -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:
>>   	}
>>   
>>   	return 0;
> 
> make this as below and remove the return above.

ok, will resend as v2.

Patch
diff mbox series

diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index 13887713f311..b8a7a84aca1c 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -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;