From patchwork Fri Feb 24 01:54:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Cvek X-Patchwork-Id: 9589251 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5B5906042D for ; Fri, 24 Feb 2017 01:55:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D8EB28768 for ; Fri, 24 Feb 2017 01:55:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3FFE128792; Fri, 24 Feb 2017 01:55:00 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D2C7628768 for ; Fri, 24 Feb 2017 01:54:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:References:To:Subject:From:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Yjla7+vGL76nAQiGkysJvli4DFMqkjZxvC5Gz3GcQGA=; b=MHQGagDXKpyxBM i/YTv05DU4Yt6dHmQF9sAwiN8Cf0yhINIVGbrCLQXpcP/FksqAOmrxcRB2l3UkVtAZ2PnMYZ+lQGN 4FHuTbE40Uu/th3yYRpvoi+Ei7Hl5uXOSeMwqeeoAduc7oVVo6Md9RBst1nx8V3bx6OnEOAKPOPLa TOXTi9TUX/ajSil/oY77asxjHKH7UhuObNpIf5igfyfPQmsA4W/DeItAFsUOI4gLX0QxlUcK9mMr8 C/1Kz7AbKo/f5z5NYuuHjP9Har9ydi/PjNas+YAr3vnX9t6MK1EfeozbjL6ayCLTGP5MvE1A+bOJL 4R8jj3ZBDfEgi+uO9IrQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ch55z-0008VE-1W; Fri, 24 Feb 2017 01:54:55 +0000 Received: from bubo.tul.cz ([2001:718:1c01:16::aa]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ch55U-00087n-24 for linux-arm-kernel@lists.infradead.org; Fri, 24 Feb 2017 01:54:29 +0000 X-Virus-Scanned: amavisd-new at tul.cz Received: from [IPv6:2001:1ae9:ff1:f191:79ae:65e2:b790:b57f] (unknown [IPv6:2001:1ae9:ff1:f191:79ae:65e2:b790:b57f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by bubo.tul.cz (Postfix) with ESMTPSA id 171A018050A23; Fri, 24 Feb 2017 02:53:58 +0100 (CET) From: Petr Cvek Subject: [PATCH v2 2/2] usb: gadget: pxa27x: Test for a valid argument pointer To: robert.jarzmik@free.fr, daniel@zonque.org, haojian.zhuang@gmail.com, balbi@kernel.org References: Message-ID: Date: Fri, 24 Feb 2017 02:54:56 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170223_175424_465776_4A8CE8FF X-CRM114-Status: UNSURE ( 9.44 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP A call usb_put_phy(udc->transceiver) must be tested for a valid pointer. Use an already existing test for usb_unregister_notifier call. Reported-by: Robert Jarzmik Signed-off-by: Petr Cvek Acked-by: Robert Jarzmik --- drivers/usb/gadget/udc/pxa27x_udc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c index 821bd8f4cae6..d48e239660c3 100644 --- a/drivers/usb/gadget/udc/pxa27x_udc.c +++ b/drivers/usb/gadget/udc/pxa27x_udc.c @@ -2531,9 +2531,10 @@ static int pxa_udc_remove(struct platform_device *_dev) usb_del_gadget_udc(&udc->gadget); pxa_cleanup_debugfs(udc); - if (!IS_ERR_OR_NULL(udc->transceiver)) + if (!IS_ERR_OR_NULL(udc->transceiver)) { usb_unregister_notifier(udc->transceiver, &pxa27x_udc_phy); - usb_put_phy(udc->transceiver); + usb_put_phy(udc->transceiver); + } udc->transceiver = NULL; the_controller = NULL;