public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [PATCH] usb: avoid NULL check before free
Date: Mon, 20 Apr 2020 03:43:05 +0200	[thread overview]
Message-ID: <754afd7e-445c-eaff-a21b-eae33ec2560c@denx.de> (raw)
In-Reply-To: <20200419100228.27804-1-xypron.glpk@gmx.de>

On 4/19/20 12:02 PM, Heinrich Schuchardt wrote:
> The free() function checks if the argument is NULL.
> Do not duplicate this check.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  drivers/usb/host/ehci-hcd.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
> index 1edb344d0f..a2a85db1e7 100644
> --- a/drivers/usb/host/ehci-hcd.c
> +++ b/drivers/usb/host/ehci-hcd.c
> @@ -1413,13 +1413,10 @@ static struct int_queue *_ehci_create_int_queue(struct usb_device *dev,
>  	debug("Exit create_int_queue\n");
>  	return result;
>  fail3:
> -	if (result->tds)
> -		free(result->tds);
> +	free(result->tds);
>  fail2:
> -	if (result->first)
> -		free(result->first);
> -	if (result)
> -		free(result);
> +	free(result->first);
> +	free(result);
>  fail1:
>  	return NULL;
>  }
> --
> 2.25.1

Applied, thanks

      reply	other threads:[~2020-04-20  1:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-19 10:02 [PATCH] usb: avoid NULL check before free Heinrich Schuchardt
2020-04-20  1:43 ` Marek Vasut [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=754afd7e-445c-eaff-a21b-eae33ec2560c@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox