From: Alan Stern <stern@rowland.harvard.edu>
To: Chengguang Xu <cgxu519@gmx.com>
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org
Subject: usb: host: remove unnecessary condition check
Date: Fri, 2 Nov 2018 10:46:49 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.44L0.1811021046200.1469-100000@iolanthe.rowland.org> (raw)
On Fri, 2 Nov 2018, Chengguang Xu wrote:
> dma_pool_destroy() can handle NULL pointer correctly, so there is
> no need to check NULL pointer before calling dma_pool_destroy().
>
> Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
> ---
> drivers/usb/host/ohci-mem.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/usb/host/ohci-mem.c b/drivers/usb/host/ohci-mem.c
> index b3da3f12e5b1..3965ac0341eb 100644
> --- a/drivers/usb/host/ohci-mem.c
> +++ b/drivers/usb/host/ohci-mem.c
> @@ -57,14 +57,10 @@ static int ohci_mem_init (struct ohci_hcd *ohci)
>
> static void ohci_mem_cleanup (struct ohci_hcd *ohci)
> {
> - if (ohci->td_cache) {
> - dma_pool_destroy (ohci->td_cache);
> - ohci->td_cache = NULL;
> - }
> - if (ohci->ed_cache) {
> - dma_pool_destroy (ohci->ed_cache);
> - ohci->ed_cache = NULL;
> - }
> + dma_pool_destroy(ohci->td_cache);
> + ohci->td_cache = NULL;
> + dma_pool_destroy(ohci->ed_cache);
> + ohci->ed_cache = NULL;
> }
>
> /*-------------------------------------------------------------------------*/
Acked-by: Alan Stern <stern@rowland.harvard.edu>
next reply other threads:[~2018-11-02 14:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-02 14:46 Alan Stern [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-11-02 14:14 usb: host: remove unnecessary condition check Chengguang Xu
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=Pine.LNX.4.44L0.1811021046200.1469-100000@iolanthe.rowland.org \
--to=stern@rowland.harvard.edu \
--cc=cgxu519@gmx.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).