diff mbox series

[01/11] staging: vchiq_arm: Replace variable ret with status

Message ID 20240604172904.61613-2-wahrenst@gmx.net (mailing list archive)
State New, archived
Headers show
Series staging: vc04_services: Random cleanups | expand

Commit Message

Stefan Wahren June 4, 2024, 5:28 p.m. UTC
The variable ret is just storing the result of last function
call like the variable status. So replace ret with status
and make a consistent use of this variable.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--
2.34.1

Comments

Laurent Pinchart June 5, 2024, 6:51 a.m. UTC | #1
Hi Stefan,

Thank you for the patch.

On Tue, Jun 04, 2024 at 07:28:54PM +0200, Stefan Wahren wrote:
> The variable ret is just storing the result of last function
> call like the variable status. So replace ret with status
> and make a consistent use of this variable.

I would have gone the other way around, and replaced 'status' with 'ret'
as the latter is more commonly used for this purpose in kernel code. I
know it will generate more churn, but I think the result will be more
maintainable.

> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> ---
>  .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> index 69daeba974f2..e2f4aa00cb70 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -1298,7 +1298,6 @@ vchiq_keepalive_thread_func(void *v)
>  	int status;
>  	struct vchiq_instance *instance;
>  	unsigned int ka_handle;
> -	int ret;
> 
>  	struct vchiq_service_params_kernel params = {
>  		.fourcc      = VCHIQ_MAKE_FOURCC('K', 'E', 'E', 'P'),
> @@ -1307,9 +1306,10 @@ vchiq_keepalive_thread_func(void *v)
>  		.version_min = KEEPALIVE_VER_MIN
>  	};
> 
> -	ret = vchiq_initialise(state, &instance);
> -	if (ret) {
> -		dev_err(state->dev, "suspend: %s: vchiq_initialise failed %d\n", __func__, ret);
> +	status = vchiq_initialise(state, &instance);
> +	if (status) {
> +		dev_err(state->dev, "suspend: %s: vchiq_initialise failed %d\n",
> +			__func__, status);
>  		goto exit;
>  	}
>
Stefan Wahren June 5, 2024, 10:04 a.m. UTC | #2
Hi Laurent,

Am 05.06.24 um 08:51 schrieb Laurent Pinchart:
> Hi Stefan,
>
> Thank you for the patch.
>
> On Tue, Jun 04, 2024 at 07:28:54PM +0200, Stefan Wahren wrote:
>> The variable ret is just storing the result of last function
>> call like the variable status. So replace ret with status
>> and make a consistent use of this variable.
> I would have gone the other way around, and replaced 'status' with 'ret'
> as the latter is more commonly used for this purpose in kernel code. I
> know it will generate more churn, but I think the result will be more
> maintainable.
i will look how many of the existing code is affect, because this is not
the only function.
>
>> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
>> ---
>>   .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>> index 69daeba974f2..e2f4aa00cb70 100644
>> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>> @@ -1298,7 +1298,6 @@ vchiq_keepalive_thread_func(void *v)
>>   	int status;
>>   	struct vchiq_instance *instance;
>>   	unsigned int ka_handle;
>> -	int ret;
>>
>>   	struct vchiq_service_params_kernel params = {
>>   		.fourcc      = VCHIQ_MAKE_FOURCC('K', 'E', 'E', 'P'),
>> @@ -1307,9 +1306,10 @@ vchiq_keepalive_thread_func(void *v)
>>   		.version_min = KEEPALIVE_VER_MIN
>>   	};
>>
>> -	ret = vchiq_initialise(state, &instance);
>> -	if (ret) {
>> -		dev_err(state->dev, "suspend: %s: vchiq_initialise failed %d\n", __func__, ret);
>> +	status = vchiq_initialise(state, &instance);
>> +	if (status) {
>> +		dev_err(state->dev, "suspend: %s: vchiq_initialise failed %d\n",
>> +			__func__, status);
>>   		goto exit;
>>   	}
>>
diff mbox series

Patch

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 69daeba974f2..e2f4aa00cb70 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -1298,7 +1298,6 @@  vchiq_keepalive_thread_func(void *v)
 	int status;
 	struct vchiq_instance *instance;
 	unsigned int ka_handle;
-	int ret;

 	struct vchiq_service_params_kernel params = {
 		.fourcc      = VCHIQ_MAKE_FOURCC('K', 'E', 'E', 'P'),
@@ -1307,9 +1306,10 @@  vchiq_keepalive_thread_func(void *v)
 		.version_min = KEEPALIVE_VER_MIN
 	};

-	ret = vchiq_initialise(state, &instance);
-	if (ret) {
-		dev_err(state->dev, "suspend: %s: vchiq_initialise failed %d\n", __func__, ret);
+	status = vchiq_initialise(state, &instance);
+	if (status) {
+		dev_err(state->dev, "suspend: %s: vchiq_initialise failed %d\n",
+			__func__, status);
 		goto exit;
 	}