linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/exynos: remove no need devm_kfree in probe [re-send, welcome any comments]
@ 2020-05-06 12:49 Bernard
  2020-05-08  7:52 ` Sam Ravnborg
  0 siblings, 1 reply; 3+ messages in thread
From: Bernard @ 2020-05-06 12:49 UTC (permalink / raw)
  To: Inki Dae, Joonyoung Shim, Seung-Woo Kim, Kyungmin Park,
	David Airlie, Daniel Vetter, Kukjin Kim, Krzysztof Kozlowski,
	dri-devel, linux-arm-kernel, linux-samsung-soc, linux-kernel
  Cc: opensource.kernel, Bernard Zhao

Remove no need devm_kfree in probe.
The change is to make the code a bit more readable

Signed-off-by: Bernard Zhao <bernard@vivo.com>
---
 drivers/gpu/drm/exynos/exynos_drm_dpi.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
index 43fa0f26c052..e06f7d7a6695 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
@@ -181,10 +181,8 @@ static int exynos_dpi_parse_dt(struct exynos_dpi *ctx)
 			return -ENOMEM;
 
 		ret = of_get_videomode(dn, vm, 0);
-		if (ret < 0) {
-			devm_kfree(dev, vm);
+		if (ret < 0)
 			return ret;
-		}
 
 		ctx->vm = vm;
 
@@ -233,10 +231,8 @@ struct drm_encoder *exynos_dpi_probe(struct device *dev)
 	ctx->dev = dev;
 
 	ret = exynos_dpi_parse_dt(ctx);
-	if (ret < 0) {
-		devm_kfree(dev, ctx);
-		return NULL;
-	}
+	if (ret < 0)
+		return ERR_PTR(ret);
 
 	if (ctx->panel_node) {
 		ctx->panel = of_drm_find_panel(ctx->panel_node);
-- 
2.26.2


[re-send, welcome any comments]
Regards,
Bernard





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/exynos: remove no need devm_kfree in probe [re-send, welcome any comments]
  2020-05-06 12:49 [PATCH] drm/exynos: remove no need devm_kfree in probe [re-send, welcome any comments] Bernard
@ 2020-05-08  7:52 ` Sam Ravnborg
  2020-05-08  8:44   ` Bernard
  0 siblings, 1 reply; 3+ messages in thread
From: Sam Ravnborg @ 2020-05-08  7:52 UTC (permalink / raw)
  To: Bernard
  Cc: Inki Dae, Joonyoung Shim, Seung-Woo Kim, Kyungmin Park,
	David Airlie, Daniel Vetter, Kukjin Kim, Krzysztof Kozlowski,
	dri-devel, linux-arm-kernel, linux-samsung-soc, linux-kernel,
	opensource.kernel

Hi Bernard.

On Wed, May 06, 2020 at 08:49:03PM +0800, Bernard wrote:
> Remove no need devm_kfree in probe.
> The change is to make the code a bit more readable
> 
> Signed-off-by: Bernard Zhao <bernard@vivo.com>

Could you take a closer look and fix similar patterns
in the rest of the driver?
For example in exynos_dpi_probe()

Is would be nice to only have to review for this
type of changes once, so one patch-set is preferred
over single patches over time.

You can add:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

to this patch when you re-send a new series.

Thanks,
	Sam

> ---
>  drivers/gpu/drm/exynos/exynos_drm_dpi.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
> index 43fa0f26c052..e06f7d7a6695 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
> @@ -181,10 +181,8 @@ static int exynos_dpi_parse_dt(struct exynos_dpi *ctx)
>  			return -ENOMEM;
>  
>  		ret = of_get_videomode(dn, vm, 0);
> -		if (ret < 0) {
> -			devm_kfree(dev, vm);
> +		if (ret < 0)
>  			return ret;
> -		}
>  
>  		ctx->vm = vm;
>  
> @@ -233,10 +231,8 @@ struct drm_encoder *exynos_dpi_probe(struct device *dev)
>  	ctx->dev = dev;
>  
>  	ret = exynos_dpi_parse_dt(ctx);
> -	if (ret < 0) {
> -		devm_kfree(dev, ctx);
> -		return NULL;
> -	}
> +	if (ret < 0)
> +		return ERR_PTR(ret);
>  
>  	if (ctx->panel_node) {
>  		ctx->panel = of_drm_find_panel(ctx->panel_node);
> -- 
> 2.26.2
> 
> 
> [re-send, welcome any comments]
> Regards,
> Bernard
> 
> 
> 
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re:Re: [PATCH] drm/exynos: remove no need devm_kfree in probe [re-send, welcome any comments]
  2020-05-08  7:52 ` Sam Ravnborg
@ 2020-05-08  8:44   ` Bernard
  0 siblings, 0 replies; 3+ messages in thread
From: Bernard @ 2020-05-08  8:44 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Inki Dae, Joonyoung Shim, Seung-Woo Kim, Kyungmin Park,
	David Airlie, Daniel Vetter, Kukjin Kim, Krzysztof Kozlowski,
	dri-devel, linux-arm-kernel, linux-samsung-soc, linux-kernel,
	opensource.kernel



From: Sam Ravnborg <sam@ravnborg.org>
Date: 2020-05-08 15:52:10
To:  Bernard <bernard@vivo.com>
Cc:  Inki Dae <inki.dae@samsung.com>,Joonyoung Shim <jy0922.shim@samsung.com>,Seung-Woo Kim <sw0312.kim@samsung.com>,Kyungmin Park <kyungmin.park@samsung.com>,David Airlie <airlied@linux.ie>,Daniel Vetter <daniel@ffwll.ch>,Kukjin Kim <kgene@kernel.org>,Krzysztof Kozlowski <krzk@kernel.org>,dri-devel@lists.freedesktop.org,linux-arm-kernel@lists.infradead.org,linux-samsung-soc@vger.kernel.org,linux-kernel@vger.kernel.org,opensource.kernel@vivo.com
Subject: Re: [PATCH] drm/exynos: remove no need devm_kfree in probe [re-send, welcome any comments]>Hi Bernard.
>
>On Wed, May 06, 2020 at 08:49:03PM +0800, Bernard wrote:
>> Remove no need devm_kfree in probe.
>> The change is to make the code a bit more readable
>> 
>> Signed-off-by: Bernard Zhao <bernard@vivo.com>
>
>Could you take a closer look and fix similar patterns
>in the rest of the driver?
>For example in exynos_dpi_probe()
>
>Is would be nice to only have to review for this
>type of changes once, so one patch-set is preferred
>over single patches over time.
>
>You can add:
>Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
>
>to this patch when you re-send a new series.
>
>Thanks,
>	Sam

Hi
Sure, this is also a good chance for me to learn this code.
I will re-check this part of the exynos driver code to see 
if there are similar patterns, and then re-send a patch series.

Regards,
Bernard

>> ---
>>  drivers/gpu/drm/exynos/exynos_drm_dpi.c | 10 +++-------
>>  1 file changed, 3 insertions(+), 7 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
>> index 43fa0f26c052..e06f7d7a6695 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
>> @@ -181,10 +181,8 @@ static int exynos_dpi_parse_dt(struct exynos_dpi *ctx)
>>  			return -ENOMEM;
>>  
>>  		ret = of_get_videomode(dn, vm, 0);
>> -		if (ret < 0) {
>> -			devm_kfree(dev, vm);
>> +		if (ret < 0)
>>  			return ret;
>> -		}
>>  
>>  		ctx->vm = vm;
>>  
>> @@ -233,10 +231,8 @@ struct drm_encoder *exynos_dpi_probe(struct device *dev)
>>  	ctx->dev = dev;
>>  
>>  	ret = exynos_dpi_parse_dt(ctx);
>> -	if (ret < 0) {
>> -		devm_kfree(dev, ctx);
>> -		return NULL;
>> -	}
>> +	if (ret < 0)
>> +		return ERR_PTR(ret);
>>  
>>  	if (ctx->panel_node) {
>>  		ctx->panel = of_drm_find_panel(ctx->panel_node);
>> -- 
>> 2.26.2
>> 
>> 
>> [re-send, welcome any comments]
>> Regards,
>> Bernard
>> 
>> 
>> 
>> 
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-08  8:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-06 12:49 [PATCH] drm/exynos: remove no need devm_kfree in probe [re-send, welcome any comments] Bernard
2020-05-08  7:52 ` Sam Ravnborg
2020-05-08  8:44   ` Bernard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).