[PATCH u-boot-marvell 09/19] net: mvneta: Fix unused variable warning if DM_GPIO is disabled

Stefan Roese sr at denx.de
Mon May 2 09:01:22 CEST 2022


On 27.04.22 12:41, Marek Behún wrote:
> From: Marek Behún <marek.behun at nic.cz>
> 
> The `ret` variable in mvneta_probe() is unused if DM_GPIO is disabled.
> 
> Since the variable is used only once after assigning value, we can
> inline the usage and drop the variable.
> 
> Signed-off-by: Marek Behún <marek.behun at nic.cz>

Reviewed-by: Stefan Roese <sr at denx.de>

Thanks,
Stefan


> ---
>   drivers/net/mvneta.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
> index 19f8145fc0..72789fc5c6 100644
> --- a/drivers/net/mvneta.c
> +++ b/drivers/net/mvneta.c
> @@ -1570,7 +1570,6 @@ static int mvneta_probe(struct udevice *dev)
>   	int node = dev_of_offset(dev);
>   	void *bd_space;
>   	int fl_node;
> -	int ret;
>   
>   	/*
>   	 * Allocate buffer area for descs and rx_buffers. This is only
> @@ -1617,8 +1616,8 @@ static int mvneta_probe(struct udevice *dev)
>   	}
>   
>   #if CONFIG_IS_ENABLED(DM_GPIO)
> -	ret = dev_read_phandle_with_args(dev, "sfp", NULL, 0, 0, &sfp_args);
> -	if (!ret && ofnode_is_enabled(sfp_args.node))
> +	if (!dev_read_phandle_with_args(dev, "sfp", NULL, 0, 0, &sfp_args) &&
> +	    ofnode_is_enabled(sfp_args.node))
>   		gpio_request_by_name_nodev(sfp_args.node, "tx-disable-gpio", 0,
>   					   &pp->sfp_tx_disable_gpio, GPIOD_IS_OUT);
>   

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de


More information about the U-Boot mailing list