[1/2] drm/fsl-dcu: remove unneeded 'ret' assignment
diff mbox

Message ID 1482943728-29421-1-git-send-email-festevam@gmail.com
State New
Headers show

Commit Message

Fabio Estevam Dec. 28, 2016, 4:48 p.m. UTC
From: Fabio Estevam <fabio.estevam@nxp.com>

When devm_kzalloc() fails there is no need to assign an error code
to the 'ret' variable as it will not be used after jumping to the
'err_node_put' label, so just remove the assignment.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
 drivers/gpu/drm/fsl-dcu/fsl_tcon.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Gabriel Krisman Bertazi Dec. 28, 2016, 6:49 p.m. UTC | #1
Fabio Estevam <festevam@gmail.com> writes:

> From: Fabio Estevam <fabio.estevam@nxp.com>
>
> When devm_kzalloc() fails there is no need to assign an error code
> to the 'ret' variable as it will not be used after jumping to the
> 'err_node_put' label, so just remove the assignment.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> ---
>  drivers/gpu/drm/fsl-dcu/fsl_tcon.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_tcon.c b/drivers/gpu/drm/fsl-dcu/fsl_tcon.c
> index 3194e54..2fbb7ee 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_tcon.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_tcon.c
> @@ -72,10 +72,8 @@ struct fsl_tcon *fsl_tcon_init(struct device *dev)
>  		return NULL;
>  
>  	tcon = devm_kzalloc(dev, sizeof(*tcon), GFP_KERNEL);
> -	if (!tcon) {
> -		ret = -ENOMEM;
> +	if (!tcon)
>  		goto err_node_put;
> -	}

Hi Fabio,

I'm curious if it is ok to not have a tcon even for devices that support
it?  If we hit -ENOMEM here, I suppose we're likely hit it too for
drm_dev_alloc and give up the initialization, so either way

Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>

>  
>  	ret = fsl_tcon_init_regmap(dev, tcon, np);
>  	if (ret) {


--
Gabriel Krisman Bertazi
Stefan Agner Feb. 8, 2017, 5:11 a.m. UTC | #2
On 2016-12-28 08:48, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
> 
> When devm_kzalloc() fails there is no need to assign an error code
> to the 'ret' variable as it will not be used after jumping to the
> 'err_node_put' label, so just remove the assignment.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>

Applied both to my drm-fsl-dcu tree.

--
Stefan

> ---
>  drivers/gpu/drm/fsl-dcu/fsl_tcon.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_tcon.c
> b/drivers/gpu/drm/fsl-dcu/fsl_tcon.c
> index 3194e54..2fbb7ee 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_tcon.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_tcon.c
> @@ -72,10 +72,8 @@ struct fsl_tcon *fsl_tcon_init(struct device *dev)
>  		return NULL;
>  
>  	tcon = devm_kzalloc(dev, sizeof(*tcon), GFP_KERNEL);
> -	if (!tcon) {
> -		ret = -ENOMEM;
> +	if (!tcon)
>  		goto err_node_put;
> -	}
>  
>  	ret = fsl_tcon_init_regmap(dev, tcon, np);
>  	if (ret) {

Patch
diff mbox

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_tcon.c b/drivers/gpu/drm/fsl-dcu/fsl_tcon.c
index 3194e54..2fbb7ee 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_tcon.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_tcon.c
@@ -72,10 +72,8 @@  struct fsl_tcon *fsl_tcon_init(struct device *dev)
 		return NULL;
 
 	tcon = devm_kzalloc(dev, sizeof(*tcon), GFP_KERNEL);
-	if (!tcon) {
-		ret = -ENOMEM;
+	if (!tcon)
 		goto err_node_put;
-	}
 
 	ret = fsl_tcon_init_regmap(dev, tcon, np);
 	if (ret) {