From patchwork Mon Aug 19 07:24:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishka Dasgupta X-Patchwork-Id: 11100381 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 914D2912 for ; Mon, 19 Aug 2019 07:25:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77AE928555 for ; Mon, 19 Aug 2019 07:25:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B455285A0; Mon, 19 Aug 2019 07:25:08 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 0A35A28555 for ; Mon, 19 Aug 2019 07:25:08 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+PFKy4RpgvVKCTBUK0ZTjCQVBm/ttQ47RdQc8g9XA2s=; b=nykPCFsbqErqy8 FNQJD5+LTEhI8HIP6d0oqZmNbj8AtPrcI6GgnlJ71lAzVtlc88hK1677tpQLgk6RHZtTFUJI/4zSC 6Fy5FKFCh3kblmv634VxxVmxAcVoarsaPwQNZUNbUZ5/d39XVug2j2XS6IUt4mFDRn8MneRKHZvjs M3JOupi8wpuH58flXf0YV3rEUqALC6FEnKKtF9cOgGp7dOVPeHUhMw2HHX0IhSrMew3vnCdwH1HjZ QDOB5MYQtQKXL5JdHmTbSFN/7a2XXD8YsjyJ0gyvI8KGKr10LFlw/C5cl/DBzMdYFYsaDnMKOY1Qz TbS9/8Ndej2q833mMoSQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hzc2N-00042T-6x; Mon, 19 Aug 2019 07:25:07 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hzc28-0003Tw-G3 for linux-arm-kernel@lists.infradead.org; Mon, 19 Aug 2019 07:24:53 +0000 Received: by mail-pl1-x644.google.com with SMTP id bj8so544548plb.4 for ; Mon, 19 Aug 2019 00:24:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n7dhYlMl//z73eacQGweSKumEFWSfBEWN+KSfFfbHHI=; b=VhH0eiPmWx5SbrmRmNTyZ+Byd8qqhGRd/QLUrNsVw6eRyDNWa+PPfBCxG5EhP/0ynJ 06rckRpaLN+OBrdr17FJqWlf74d3miggbogYkxalARhmPPAnLNiPN8BSwL6xkYEepv7g GpNCZ6z+XA2EOtXNefssS04Z6XGDZtd3ttD8uEoHa361laIzlxvH/5QOkCdmFZ+r7jfT BiyEvst69I+yNbVOsUjpdckeQuirWzcAn+Jlz6p0dZQbTPEHCDOjedc3JL80sBRApbf4 o7AfVwMw1MWqnC4w4hoqimp6G+htJPqhk9uPzn0+XEHx7LZW20thLbmV7uWAGsQmjGzt KvVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n7dhYlMl//z73eacQGweSKumEFWSfBEWN+KSfFfbHHI=; b=WffioKINFDYxLBJZ5Oh0VRxC3a7nrGN60ABsYAzdGLcHaUFy/P6QbrLrK0yYQTzj2n KTuS5u8jIwGwwsHcx3lBrE1MbFw0m+mpI+m0h1ttHCqa/y0tQNsYXYsI8TxakZH7DNvd I4eJ+yHN9UN+G7RqFLKpMMeX7D/WiA5Ga3eiTxONB4mqS3gOq0IatvXKXFsQPWmq7Sg5 yPwadoDVbcfr5JjTZatUlkgpjF9blJLeTrxE31rLiWOE3Y7M0ejPiNNODs6SLALKNzLB VkjtQg8f3b2zkqGoae9ffCxHIpyiQ1XQJGXnxL4XhVHqVAOzsZ8jrvr6eDi86my02Cas ZVQQ== X-Gm-Message-State: APjAAAWEqXi/murpiQjgi9S4/OFi6JZ4wJ1WGyLRIKW34+pt9fy4hXna hy5dh1SyGUOJwF1f8wRrDtU= X-Google-Smtp-Source: APXvYqyoWxQlwcpntJ672OeWe7rLF7xYFp0iacILMOmsGwKthmm0U3ynEBTnbdeuQjHC50gFN+IIrw== X-Received: by 2002:a17:902:29eb:: with SMTP id h98mr21709529plb.128.1566199491894; Mon, 19 Aug 2019 00:24:51 -0700 (PDT) Received: from localhost.localdomain ([110.225.16.165]) by smtp.gmail.com with ESMTPSA id u3sm11064496pjn.5.2019.08.19.00.24.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 00:24:51 -0700 (PDT) From: Nishka Dasgupta To: patrice.chotard@st.com, balbi@kernel.org, gregkh@linuxfoundation.org, linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org Subject: [PATCH 2/2] usb: dwc3: st: Add of_dev_put() in probe function Date: Mon, 19 Aug 2019 12:54:36 +0530 Message-Id: <20190819072436.31402-2-nishkadg.linux@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190819072436.31402-1-nishkadg.linux@gmail.com> References: <20190819072436.31402-1-nishkadg.linux@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190819_002452_567628_89D25146 X-CRM114-Status: GOOD ( 11.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nishka Dasgupta 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 In function st_dwc3_probe, variable child_pdev takes the value returned by of_find_device_by_node, which gets a device pointer but does not put it. If child_pdev is not put before the probe function returns, it may cause a reference leak. Hence put child_pdev after its last usage. Issue found with Coccinelle. Signed-off-by: Nishka Dasgupta Reviewed-by: Patrice Chotard --- drivers/usb/dwc3/dwc3-st.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c index 6f52c749cd58..c682420f25ca 100644 --- a/drivers/usb/dwc3/dwc3-st.c +++ b/drivers/usb/dwc3/dwc3-st.c @@ -274,6 +274,7 @@ static int st_dwc3_probe(struct platform_device *pdev) dwc3_data->dr_mode = usb_get_dr_mode(&child_pdev->dev); of_node_put(child); + of_dev_put(child_pdev); /* * Configure the USB port as device or host according to the static