All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: ether: avoid NULL check before free()
@ 2020-04-19 10:11 Heinrich Schuchardt
  2020-04-20  1:43 ` Marek Vasut
  0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2020-04-19 10:11 UTC (permalink / raw)
  To: u-boot

free() checks if its argument is NULL. Do not duplicate this check.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 drivers/usb/gadget/ether.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index a118283984..8533abfd93 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -2472,8 +2472,7 @@ static int _usb_eth_send(struct ether_priv *priv, void *packet, int length)
 		}
 		usb_gadget_handle_interrupts(0);
 	}
-	if (rndis_pkt)
-		free(rndis_pkt);
+	free(rndis_pkt);

 	return 0;
 drop:
--
2.25.1

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

* [PATCH] usb: ether: avoid NULL check before free()
  2020-04-19 10:11 [PATCH] usb: ether: avoid NULL check before free() Heinrich Schuchardt
@ 2020-04-20  1:43 ` Marek Vasut
  0 siblings, 0 replies; 2+ messages in thread
From: Marek Vasut @ 2020-04-20  1:43 UTC (permalink / raw)
  To: u-boot

On 4/19/20 12:11 PM, Heinrich Schuchardt wrote:
> free() checks if its argument is NULL. Do not duplicate this check.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  drivers/usb/gadget/ether.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
> index a118283984..8533abfd93 100644
> --- a/drivers/usb/gadget/ether.c
> +++ b/drivers/usb/gadget/ether.c
> @@ -2472,8 +2472,7 @@ static int _usb_eth_send(struct ether_priv *priv, void *packet, int length)
>  		}
>  		usb_gadget_handle_interrupts(0);
>  	}
> -	if (rndis_pkt)
> -		free(rndis_pkt);
> +	free(rndis_pkt);
> 
>  	return 0;
>  drop:
> --
> 2.25.1

Applied, thanks.

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

end of thread, other threads:[~2020-04-20  1:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-19 10:11 [PATCH] usb: ether: avoid NULL check before free() Heinrich Schuchardt
2020-04-20  1:43 ` Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.