[PATCH 11/32] of: silence warning about never-read error assignment

Sascha Hauer sha at pengutronix.de
Mon Sep 12 02:41:18 PDT 2022


On Mon, Sep 05, 2022 at 11:55:36AM +0200, Ahmad Fatoum wrote:
> err is assigned specific error codes, but they are not propagated and
> instead NULL is returned for error. Make it explicit that we handle all
> errors the same by typecasting to (void).

This warning likely goes back to assigning the variable 'err' right
before jumping to the label 'err':

	err = -EINVAL;
	goto err;

The assignment is indeed unused. We should remove this assignment
rather than suppressing the resulting warning.

Sascha

> 
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
>  drivers/of/resolver.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/of/resolver.c b/drivers/of/resolver.c
> index 2457ae96a412..510d36f95192 100644
> --- a/drivers/of/resolver.c
> +++ b/drivers/of/resolver.c
> @@ -272,6 +272,7 @@ out:
>  err:
>  	of_delete_node(result);
>  
> +	(void)err;
>  	return NULL;
>  
>  }
> -- 
> 2.30.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list