Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp693798ybg; Mon, 1 Jun 2020 11:52:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUgio7i+3jLIZYUPQ40levEnd8Y30BIbbgq2z+wX8rjdydQqEEieNxIvqqe/1cC6OYDLMc X-Received: by 2002:a17:906:cd03:: with SMTP id oz3mr21706774ejb.391.1591037534196; Mon, 01 Jun 2020 11:52:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591037534; cv=none; d=google.com; s=arc-20160816; b=CxcPOqO4eMT5Iuj1fuWPoZ8+oVRGZBPGbFz6vbpEYCuw7B/iyqA1lzonkD/3wDAKAa 9spxiwP6Ieihdig7om5hmZB9CwATRAz3OJMZHYwcy0YP+ZZd6OD4XKalpCzfrYjJbDOB UkyHpNHFfGc1B3HINW4tLuBed8vNJaSTZI/PWJ6XvQHr+7wuhU8Eth0382TuH+eS5SbW 4Qxv29vh6vREKn5BgDL5raxrbN9iHTMHYfhO3z/mDOz9JqpGYuMWaS6mANxqtD53rFzL gU6tkCA7gOibjOJDB99eY9SsyzdojaEC7UnaB17YJX1ZTS4o4EDsz1vzX3nh/SPiYC0T A4Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4xayQkZQBNRFMT8yTaPref9N3Lo5WXR45BG+uzwbWpM=; b=bZOk/Np9fhgi8TB4qFHcuWuKYngjbQaOTZ7CbY20ZUQwxg6pcLiqWHtDXTSssFyLgS 8ukD5qrC0NLYx46mpU36Bk7hBLQgwyhx8N1lRf+LCL3qtrK7sMqjIN380rzBWtXLdDvk N1p+utNohAPn8dLks0wiKRDJIIDxxmlAR4jOV24g2nLnlkEMAI+6hIi2afa7rKhDJHGI H1utkNOuwEh/7HL8SIFGo2JIUINjOoL5XiL7stNXHUcyoeSPFndgaSKzVCLw0BobP+Vd X46UTiX+9BY+V5b6wJQk3WoH0ls7oNDGjzSIPxQ9HvkdrA/pjfh9kn25i9SxUK2+y8mM Ex7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Jugvma84; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m10si129192edv.322.2020.06.01.11.51.50; Mon, 01 Jun 2020 11:52:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Jugvma84; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728673AbgFASsH (ORCPT + 99 others); Mon, 1 Jun 2020 14:48:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:53844 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730638AbgFASHw (ORCPT ); Mon, 1 Jun 2020 14:07:52 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AEB34206E2; Mon, 1 Jun 2020 18:07:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591034872; bh=uB/nrNTc33V1p9MjKZ2UT3WMBnL+IeRKZpIjZGkr7aQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jugvma84d9hBxTQmNUa9msUuXw9WWFWA0Bc/K4Pp/xCaED8aIHgXAjJyWIuPU6xwj A2PiwUBS9pwZcY5KMhKOSSBszhGg9bIkk0CqwzrBwH3MbiGMEX6Uyk0wEyZttCNJ76 mt5/WF3N/GuaGAOqjMs7GKuUBmVzeafWoKiNsjhE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Christophe JAILLET , Felipe Balbi , Sasha Levin Subject: [PATCH 5.4 049/142] usb: phy: twl6030-usb: Fix a resource leak in an error handling path in twl6030_usb_probe() Date: Mon, 1 Jun 2020 19:53:27 +0200 Message-Id: <20200601174042.900048690@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601174037.904070960@linuxfoundation.org> References: <20200601174037.904070960@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET [ Upstream commit f058764d19000d98aef72010468db1f69faf9fa0 ] A call to 'regulator_get()' is hidden in 'twl6030_usb_ldo_init()'. A corresponding put must be performed in the error handling path, as already done in the remove function. While at it, also move a 'free_irq()' call in the error handling path in order to be consistent. Reviewed-by: Dan Carpenter Signed-off-by: Christophe JAILLET Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin --- drivers/usb/phy/phy-twl6030-usb.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/usb/phy/phy-twl6030-usb.c b/drivers/usb/phy/phy-twl6030-usb.c index bfebf1f2e991..9a7e655d5280 100644 --- a/drivers/usb/phy/phy-twl6030-usb.c +++ b/drivers/usb/phy/phy-twl6030-usb.c @@ -377,7 +377,7 @@ static int twl6030_usb_probe(struct platform_device *pdev) if (status < 0) { dev_err(&pdev->dev, "can't get IRQ %d, err %d\n", twl->irq1, status); - return status; + goto err_put_regulator; } status = request_threaded_irq(twl->irq2, NULL, twl6030_usb_irq, @@ -386,8 +386,7 @@ static int twl6030_usb_probe(struct platform_device *pdev) if (status < 0) { dev_err(&pdev->dev, "can't get IRQ %d, err %d\n", twl->irq2, status); - free_irq(twl->irq1, twl); - return status; + goto err_free_irq1; } twl->asleep = 0; @@ -396,6 +395,13 @@ static int twl6030_usb_probe(struct platform_device *pdev) dev_info(&pdev->dev, "Initialized TWL6030 USB module\n"); return 0; + +err_free_irq1: + free_irq(twl->irq1, twl); +err_put_regulator: + regulator_put(twl->usb3v3); + + return status; } static int twl6030_usb_remove(struct platform_device *pdev) -- 2.25.1