Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp509004pxx; Wed, 28 Oct 2020 09:56:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAJ1RtUxq3CXDTDEPLVVsWCZLp1P69xwQrRF75C2DYAGr/OoNWg9HD6qwx1Ba67+Ujk/2r X-Received: by 2002:a1c:4c04:: with SMTP id z4mr391587wmf.2.1603904192349; Wed, 28 Oct 2020 09:56:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603904192; cv=none; d=google.com; s=arc-20160816; b=ULUrZyy9tEcLT4YPcM0GmXVU7y8SOk5q8kvWbeDXgwt9QT7PZ1SVNPFjEytdjYnX9F L++tQ2oNY8hWRFG4xjtkz3Q9w7W4/OiEaUMHPoY/Y+Yl2dnIQ8OABTmB5Xh8Y3P1iJst roV7FlRoB+fC7JFr++r/ght369YS7vaoCBOuHMedd7KyItIOTwW4wpfixnUQoE6QxqC3 JvQ7xjTHjyNHWv3uBvU33csL3joqEnjyiKKtzXpYlZgmVTilP7H0VIZxNdNi9HldXVkw vaZ5YsyO0kFwFLLZ1scql2zsKleR/L+/EG24YauTEKxQEgWfKuq83x/eVQapWcmSaoNO rcXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UtnAC0nSWMzO+kvbWzd6vL8u3M6AKYvDEFZnYa/xmoY=; b=PXcu4AP+9RxlPMku3XiTytSvVa3kIlg+n0QqRzywMq/nh7s8RTFaAh8ApYSIqSmKeU sNRrVJplb+q82kSmb20sCHUzk1qA7dIetrmKnWTssPNJ09O55bXQKWZUd2u9NiBgiSc4 Yw5oNe/JRt7ysrRxuzk9Ja75QQoqVkNpcWsfH8ozYD4GJbB6WG87DRdJM/naBpRe7QYl gP0pasBWcIHbwF8q3+1hCBr9nRzrSYxeLSc6ePi6tOyTg/pcirCpygMe3+SERpNZFMWy 5EqRo04F1g+SBXO0rEknuaUI1qOY9opZh+kcfFY7Y2lMZwF4gDesIkQTKr5j/oAoa0yQ R4xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qRCCt1pn; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g16si3749206ejk.300.2020.10.28.09.56.10; Wed, 28 Oct 2020 09:56:32 -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=qRCCt1pn; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1818927AbgJ0R0B (ORCPT + 99 others); Tue, 27 Oct 2020 13:26:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:53956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2900515AbgJ0Oxh (ORCPT ); Tue, 27 Oct 2020 10:53:37 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 6DFA122281; Tue, 27 Oct 2020 14:53:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810417; bh=9CLILCPVgTaUt4VkfpGYMDGq5kPlOrV2Y9UK5QuXMk0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qRCCt1pn/h96Fj7HkDQ8HDxPaGfTVExdPKuBalLDZ4r3+ATTXq/MH9ITbEsXs2naQ pdb+MEpxnexy79CWFNTrA/UCEpNBVtmE2fXytkJgBDNajU8V2pXdjiPoCFUxIIMH4K PVr5wAwbyuxXlJ9rUVAaW02Rb9TjOwcWJLaeRu/4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , "Dr. David Alan Gilbert" , Guenter Roeck , Sasha Levin Subject: [PATCH 5.8 131/633] hwmon: (w83627ehf) Fix a resource leak in probe Date: Tue, 27 Oct 2020 14:47:54 +0100 Message-Id: <20201027135528.831109185@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit 18360b33a071e5883250fd1e04bfdeff8c3887a3 ] Smatch has a new check for resource leaks which found a bug in probe: drivers/hwmon/w83627ehf.c:2417 w83627ehf_probe() warn: 'res->start' not released on lines: 2412. We need to clean up if devm_hwmon_device_register_with_info() fails. Fixes: 266cd5835947 ("hwmon: (w83627ehf) convert to with_info interface") Signed-off-by: Dan Carpenter Reviewed-by: Dr. David Alan Gilbert Link: https://lore.kernel.org/r/20200921125212.GA1128194@mwanda Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin --- drivers/hwmon/w83627ehf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index 5a5120121e507..3964ceab2817c 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c @@ -1951,8 +1951,12 @@ static int w83627ehf_probe(struct platform_device *pdev) data, &w83627ehf_chip_info, w83627ehf_groups); + if (IS_ERR(hwmon_dev)) { + err = PTR_ERR(hwmon_dev); + goto exit_release; + } - return PTR_ERR_OR_ZERO(hwmon_dev); + return 0; exit_release: release_region(res->start, IOREGION_LENGTH); -- 2.25.1