Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1027522pxb; Fri, 13 Nov 2020 02:11:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJwxlc15I0VvLOd/HFcXo52BkIe7eii8gjulG+6jgrjnVpjr+sQ0F95M/8DaVWckSW5njqQW X-Received: by 2002:aa7:c313:: with SMTP id l19mr1703638edq.293.1605262270142; Fri, 13 Nov 2020 02:11:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605262270; cv=none; d=google.com; s=arc-20160816; b=CHW1vBnMQumxcSFm3JCQfJZIyr8+NDlSE4BHcwbyXkra7pcEYooLQmFySPMzJrZBBc 0iAtn7FxZeZMgI9efd4KnL8XPX7h97RgNyK302faQ36d/s1aeNenbigxb1YTsnkQc4Qf c3UVcEDvgefgF7nC6V/lEkxuDYTT7pBb+cDWR6bC9vTpcALt7juOcdc6D0Yt6/d3uST9 a7Mrj/ol2D9XhuuNSY8q6/zkdn/3KQ8uSejBoL3pOvFDvYusilA8XoPwnGxTqXH3+oaW uhbgmqXObg8wRhW7xMKPHOtwth2HLPqTYFWBZpKXAeeRzo87GXDGzdevGFLt2/4vbh6R flHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=CmOkNnoq4aouIzIKH5BdnPNOjPDxlp5PbgvCa+MCvGk=; b=WB8srTaXe9pIhPQ9Vc69XC+R17mc6VWxWkxDbqqy536wS+jnp2VMhOqBujX2Yzy9k2 l1jDyRJOUz7IisaiDEPKiYGsfcWcuNY6PqK4hm0aScpt74Qyv8qu54kqnu8gc4XtPw3I 7GwFATRKvbp3Ulxx72Jp6axYzMefMGX7WHfZHO/Cb0AnAWj1x6cvmb8XV9aU0P4eC3jh T5RGN6CZ6kPMt/rzBoFFe+05jwRS2JXWF1vRN8cHaxNeMRNUecBQwa25QyHLJed+xKvc iCJfTwt2sipD84MQzx4jqTGA3R3u+rEOkPTlwjsd6DWQwkwPzgR1ckgGxlZIugGriEWI q2AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b="dI57/+8h"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g18si5995469edq.53.2020.11.13.02.10.45; Fri, 13 Nov 2020 02:11:10 -0800 (PST) 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=@oracle.com header.s=corp-2020-01-29 header.b="dI57/+8h"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726296AbgKMKJY (ORCPT + 99 others); Fri, 13 Nov 2020 05:09:24 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:45084 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726176AbgKMKJX (ORCPT ); Fri, 13 Nov 2020 05:09:23 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0ADA44We195662; Fri, 13 Nov 2020 10:09:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2020-01-29; bh=CmOkNnoq4aouIzIKH5BdnPNOjPDxlp5PbgvCa+MCvGk=; b=dI57/+8hQXv2he9Ovg5TnVAUuFuHYAM82lFIXcQbjrtLPV7GerAapaQ4Z5wj6gIZUA5J 02MituRHDV5X2aTmzaLiekpz0kBe35D1QMLql5cjsnS7DhN5gCd5otHEHBghGj4D0yt1 tlcAqHg9lT2x53EUUUwVSqwIGHR2PPO82BtGShXH8WNJVzj158EV3F2DfkQOb4PvGPIN w40wsZcCk6rzf7vWGFJVw5KWFAlRxy/9zergNwvCyc41Bzhxh6T/1eJArspl29WcVmyn eArnpahUzu1ng5OYO48vULf6UTTq/VCFaxjgC/JmKIKQB8nfeiJnU8erSPeskB7jeh/1 Xg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 34nkhm9rnh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 13 Nov 2020 10:09:06 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0ADA6HoS164926; Fri, 13 Nov 2020 10:09:05 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 34rtktbk6j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Nov 2020 10:09:05 +0000 Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0ADA8vq3027309; Fri, 13 Nov 2020 10:08:57 GMT Received: from mwanda (/10.175.206.108) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 13 Nov 2020 02:08:56 -0800 Date: Fri, 13 Nov 2020 13:08:50 +0300 From: Dan Carpenter To: Joel Stanley Cc: Andrew Jeffery , Tom Rix , linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] soc: aspeed: Fix a reference leak in aspeed_socinfo_init() Message-ID: <20201113100850.GA168908@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9803 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 phishscore=0 suspectscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011130060 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9803 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 priorityscore=1501 mlxscore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 spamscore=0 malwarescore=0 adultscore=0 clxscore=1011 bulkscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011130060 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This needs to call of_node_put(np) before returning if of_iomap() fails. Fixes: e0218dca5787 ("soc: aspeed: Add soc info driver") Signed-off-by: Dan Carpenter --- drivers/soc/aspeed/aspeed-socinfo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/soc/aspeed/aspeed-socinfo.c b/drivers/soc/aspeed/aspeed-socinfo.c index 20a1d4aeb051..773930e0cb10 100644 --- a/drivers/soc/aspeed/aspeed-socinfo.c +++ b/drivers/soc/aspeed/aspeed-socinfo.c @@ -74,8 +74,10 @@ static int __init aspeed_socinfo_init(void) } reg = of_iomap(np, 0); - if (!reg) + if (!reg) { + of_node_put(np); return -ENODEV; + } siliconid = readl(reg); iounmap(reg); -- 2.28.0