From patchwork Fri Nov 2 14:14:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengguang Xu X-Patchwork-Id: 10665573 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CDFE0157A for ; Fri, 2 Nov 2018 14:14:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B71292BE86 for ; Fri, 2 Nov 2018 14:14:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A88862BE92; Fri, 2 Nov 2018 14:14:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2CBBB2BE86 for ; Fri, 2 Nov 2018 14:14:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727751AbeKBXV5 (ORCPT ); Fri, 2 Nov 2018 19:21:57 -0400 Received: from mout.gmx.net ([212.227.17.20]:45975 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727744AbeKBXV5 (ORCPT ); Fri, 2 Nov 2018 19:21:57 -0400 Received: from localhost.localdomain ([113.116.157.11]) by mail.gmx.com (mrgmx103 [212.227.17.174]) with ESMTPSA (Nemesis) id 0MXIGf-1g4Vir46Uv-00WGp3; Fri, 02 Nov 2018 15:14:38 +0100 Received: from localhost.localdomain ([113.116.157.11]) by mail.gmx.com (mrgmx103 [212.227.17.174]) with ESMTPSA (Nemesis) id 0MXIGf-1g4Vir46Uv-00WGp3; Fri, 02 Nov 2018 15:14:38 +0100 From: Chengguang Xu To: stern@rowland.harvard.edu, gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, Chengguang Xu Subject: [PATCH] usb: host: remove unnecessary condition check Date: Fri, 2 Nov 2018 22:14:27 +0800 Message-Id: <20181102141427.17109-1-cgxu519@gmx.com> X-Mailer: git-send-email 2.17.2 X-Provags-ID: V03:K1:Z4Y6rBMNUYJTW11HV7T/LSIf0ARTH8/XNpEvfN9/A3YqtKtgc1B Kn9XnjZLZSeAyhXu//d+ZoQyuH6hL/PEdEf0fq13/GL8Eccs7qtCDEDdlqkG7fEhvG9uDU+ uH4SRuTyfF71PvWskeHElQ+YEtPcAc9p1Q4bgAy4irSAjlfqzOPut3qPUlPLbd1C/awkeRf UwzgM2jbseG9m8/Ep095A== X-UI-Out-Filterresults: notjunk:1;V01:K0:nQnlRcKmAy4=:pN62K95i8/Oc8Fp9GutV9I 4iClqLMTnDaef/o/DLIBFNNunXeYhX9BlFqUXYmIq1TR2gyW7vrWDj/GHhIFiXI0qZDWEolEl fsZtEHOBwU2CuP2TKVjrG8Du9Mk5vNGOe4nE+C0jYo7rxhB8+0gsH93gVnkTo7YCwmP0xbG3d YosHKysKw8MhnhwFIMKYshIwpeRE6pEPHYMSYsNSOae11YNetKdI+16Sdb3eaQMx0+wJDzsK4 csx9hIGbucfbdst25UHJt4l0w6TcUxGoSsbUbvqySswjn2vEHU6ovelVIVYnfydbO9LmoMdMc Zw4nUftRGWzSOkIUSHtjo5gvhXM86IWtKuvQl96yRjpD6m93JNmhJEe48SfQt9j+JQ+xI+U+R 79D/gvZ+Vw7yyejwMIUh10m+08P6XazDkrfZ/0EPVrDroTz9vNQYOkpFZI/J+CslUlWHTpOq9 L6hYruDvXL1biPXALB8V6f4WOaSFkbMT/GWYq1rqSNXo7mx6ntAKaBug2cavp0EUh8rrIakKO hoEiWSj02j2kSGpmYMUXPCDJznRIxGsqzOPqmy0+9fCUGDkXdAsccLktYwJ/JwYx0+7S6B53K g1OB/bOO9EYPw6RX2/mA4Sh/zTY2zqm5x7pYanRm9vzxLLpmpzs0zjq5juR3UaLvhXWpjC1xa b7mr3JgOWocfwxG5RoSlGywGIAGIlszdWg/j7TR79vhyHUdl661Mn9GRWdVMSmw5jYU7PDw3m tL2KDr9X28wEFCrh9ApJeyxb7r5NMKgu4rVOj4FaaLMX8nzbXrXJdeyQOwcGltpYo0ZLL1Ig+ 8YFnkp1vFS32pm1geCa6+MnxgDSE4IkR/Qi+bCwanNMNPaAjNV/6PfNBm/04Nj3YCQjA5zaS5 NNruhIbp8I2YtHJAnXWG0IvHkepYeonvIZQLjLcT8= Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Alan Stern --- 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; } /*-------------------------------------------------------------------------*/