From patchwork Tue Mar 26 08:12:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mukesh Ojha X-Patchwork-Id: 10870625 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 831BE1575 for ; Tue, 26 Mar 2019 08:12:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7203B28A06 for ; Tue, 26 Mar 2019 08:12:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 665F328F96; Tue, 26 Mar 2019 08:12:34 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 D692C28A06 for ; Tue, 26 Mar 2019 08:12:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730709AbfCZIMd (ORCPT ); Tue, 26 Mar 2019 04:12:33 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:43870 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726270AbfCZIMc (ORCPT ); Tue, 26 Mar 2019 04:12:32 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 511FB609CD; Tue, 26 Mar 2019 08:12:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1553587952; bh=LpuCn0nrIOxod4WpgS2Jk2Nq1TE0TBmK90h3pB7FzzU=; h=From:To:Cc:Subject:Date:From; b=b9wro4BMnneHOUWwXC/pE6aReK4Tj5w16xmjZ/9JDF6AM/FxjTd+TGD1aefwtFOTR x6BWAebqrBoQEiYI3sWnUetPWrerZOuWvkLqTZtrtEqTFOQ7iRR53CjDXZgic7FKgT 9ew5Q9zvvB/PmI7gFuX86wi/GZSpPqF0noQdWP7Y= Received: from mojha-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mojha@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 4EBB760A60; Tue, 26 Mar 2019 08:12:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1553587951; bh=LpuCn0nrIOxod4WpgS2Jk2Nq1TE0TBmK90h3pB7FzzU=; h=From:To:Cc:Subject:Date:From; b=U5NbNTeaodr/yJBpjBmIuFaheWMAWMXTcrCGeYVkdm4ssW/5k38ga9h5V6ULS+rAl oIzFDwpDM6OrYepWdobI59Vjz/H1+4vrLk5bMZtiItEHdRt0RuZYu5STLv125HC35v 0SeSAjfT7QoMzllJbCQbT8dHULXRz+zBXI3QVRL8= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 4EBB760A60 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=mojha@codeaurora.org From: Mukesh Ojha To: kjlu@umn.edu, pakki001@umn.edu, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, colin.king@canonical.com Cc: Mukesh Ojha Subject: [PATCH] usb: u132-hcd: fix resource leak Date: Tue, 26 Mar 2019 13:42:22 +0530 Message-Id: <1553587942-14037-1-git-send-email-mojha@codeaurora.org> X-Mailer: git-send-email 1.9.1 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 if platform_driver_register fails, cleanup the allocated resource gracefully. Signed-off-by: Mukesh Ojha --- This patch is dependent on "usb: u132-hcd: fix potential NULL pointer dereference" by Kangjie Lu, otherwise it may give merge conflict. drivers/usb/host/u132-hcd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c index 934584f..1d8d578 100644 --- a/drivers/usb/host/u132-hcd.c +++ b/drivers/usb/host/u132-hcd.c @@ -3204,6 +3204,9 @@ static int __init u132_hcd_init(void) printk(KERN_INFO "driver %s\n", hcd_name); workqueue = create_singlethread_workqueue("u132"); retval = platform_driver_register(&u132_platform_driver); + if (retval) + destroy_workqueue(workqueue); + return retval; }