Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1271451pxf; Fri, 9 Apr 2021 04:33:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwBxdBfJQJPPDUFECKhoLnL/DVGm36qI2p1LJwrPR+CTMSjDxMriuC32K9SQLg4b55M1vW X-Received: by 2002:a63:dd14:: with SMTP id t20mr12762857pgg.258.1617968039200; Fri, 09 Apr 2021 04:33:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617968039; cv=none; d=google.com; s=arc-20160816; b=mvK+ihH76Xb8vJNXQHREiDj/pgC3dFtsWZmMrirVKAw1Q++pD3rBECNjluLxCEq66m 2ty89iOrWzU1WXIPHIfsOSRW5WRjkcw/hrG0a+6OiRt04EZcTA5Bug63087h12OUHUL3 351iGPC7R4CzK+L3VtUyCDVA7Qqndc5Sxq1zJ1aX5V+V0dsUZ3WU4T6DJCKl92i/KrOd 7RpDPymeeIdQ8njHtS6GWyfpc9jg2Qn/vF0IeGp8g/9Xxr9cgRY/9P1GEpCatyLRtaVb e+1/bxKdSMMkI1T2YBOID7lvaZLtCYLTAinR4gcEBTQqeBlH7Ks5kCrQEny+YaMmXjt7 BHJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=OEe6YFfe/Jx9/mKOq9o87zYJfICMbLoDqKrtcURwasI=; b=WDkpYtHXX0NOicRzxtIhUHkCsw5fHJt6mKo7dLjVq6wac+lWsdAXsFuo6yEEUGYqfH sAVBZtTM7IX1grqJIJTM9GJQ0JsFMgxHvC8vFJvuM4JM+IvwTOoGNopi8pwwVy/jkpHk VtGGu4ibMq+cHBbw86PCOyGsx6qis9tA2KI66j8d2sJIyQ3z7c2TuHlzQiEH7Da7W2d9 ibMSHmgqhGNtT0V3h+TyqBE0uNM4te1R0ZOL4g5UMfyHSHVqCeDY6LVUKjkb/tAzPd5i MK7HWV8VGbAHjVlNwkY4NnV1l0i1zq3t4zhYaEJi1Qf1qo/4w7AP3o6h9oE7pNjOoiIZ ztsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Fh1lg/uR"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t197si2540007pfc.265.2021.04.09.04.33.47; Fri, 09 Apr 2021 04:33:59 -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=@gmail.com header.s=20161025 header.b="Fh1lg/uR"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233637AbhDILcO (ORCPT + 99 others); Fri, 9 Apr 2021 07:32:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231599AbhDILcO (ORCPT ); Fri, 9 Apr 2021 07:32:14 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28CD2C061760; Fri, 9 Apr 2021 04:32:01 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id e34so797997wmp.0; Fri, 09 Apr 2021 04:32:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=OEe6YFfe/Jx9/mKOq9o87zYJfICMbLoDqKrtcURwasI=; b=Fh1lg/uRnalLCCr33soqPo1Q0j0NEuOetXw4MI3EsYdb3SzqSsJDbZY2la+9cmm5+Z 0lr7GuLSJNz/FdIXSa0GLxggvKPPJy4dIBIzESbAoQznwkIs0V1AGV7aZxHYdYKmF7zQ 4uPUQhlN5HdQcfI8dTcmNklqzyFjhQWR51LLj0FFaIAVcppbz8enltWhxVFWZ2rroyvv LChvClJD8W/t7evnMeWUw0iZLLa+eF8WM936p5nUg9aTNVj7XUziKGV1dbh87s2VhMkk XYRaiuFqS1GTvaw27dBSY7vul7ZY4Jmt9dV1jsya42FgMrJ8w4fHO7QX/i+/47FnIIOp JHhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=OEe6YFfe/Jx9/mKOq9o87zYJfICMbLoDqKrtcURwasI=; b=GtgqLSPjQvZzjH/JgzR4Jo9xBDgtnr+RpDlW58t4mwtdB+tTXbFFFFkNeIlrDVz8Ic cyaqJIjRU3r341xfqDhfrVFA5DHD7aM1J0JXwuuCCG54ETxStvH5I0vHchF5rd5jSUDw M83f543r81F9+htR6dS38zluEe5BOdgOzPr+8CQshD0S8p39KEFh/UDdW6gI3Ng1GEbC c+KmVjJoWFRLOI4YQOFO2LXLTKRTZQLJIPBpp73GRrfOTnQMb6b/6mrnvsK2nbGp3VMx /G9+jNqfJW910yndpp2bUCltPI+OXsPXyuwEUnzjBZtncys4DdfdeiN5etEmwIcvJRFK 1bRg== X-Gm-Message-State: AOAM532AEb5m+cN8RdK8WuSIW4gDI1XfmH3RxPQa/bFIzR0kfcY447ny ue7jJUSLC6SBMfQ+rAkrSLo= X-Received: by 2002:a05:600c:1457:: with SMTP id h23mr13470302wmi.118.1617967919927; Fri, 09 Apr 2021 04:31:59 -0700 (PDT) Received: from localhost (pd9e51abe.dip0.t-ipconnect.de. [217.229.26.190]) by smtp.gmail.com with ESMTPSA id w11sm3470311wmb.35.2021.04.09.04.31.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Apr 2021 04:31:58 -0700 (PDT) Date: Fri, 9 Apr 2021 13:32:34 +0200 From: Thierry Reding To: Yang Yingliang Cc: linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, jonathanh@nvidia.com Subject: Re: [PATCH -next] soc/tegra: fuse: add missing iounmap() on error in tegra_init_fuse() Message-ID: References: <20210409044903.663632-1-yangyingliang@huawei.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="JEhcvQN4vxPMMub6" Content-Disposition: inline In-Reply-To: <20210409044903.663632-1-yangyingliang@huawei.com> User-Agent: Mutt/2.0.6 (98f8cb83) (2021-03-06) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --JEhcvQN4vxPMMub6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 09, 2021 at 12:49:03PM +0800, Yang Yingliang wrote: > Add the missing iounmap() before return from tegra_init_fuse() > in the error handling case. >=20 > Fixes: 9f94fadd75d3 ("soc/tegra: fuse: Register cell lookups for compatib= ility") > Reported-by: Hulk Robot > Signed-off-by: Yang Yingliang > --- > drivers/soc/tegra/fuse/fuse-tegra.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse= /fuse-tegra.c > index 94b60a692b51..bc8d70e6a676 100644 > --- a/drivers/soc/tegra/fuse/fuse-tegra.c > +++ b/drivers/soc/tegra/fuse/fuse-tegra.c > @@ -489,8 +489,10 @@ static int __init tegra_init_fuse(void) > size_t size =3D sizeof(*fuse->lookups) * fuse->soc->num_lookups; > =20 > fuse->lookups =3D kmemdup(fuse->soc->lookups, size, GFP_KERNEL); > - if (!fuse->lookups) > + if (!fuse->lookups) { > + iounmap(fuse->base); > return -ENOMEM; > + } > =20 > nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups); > } I don't think that's a good idea. Given that this is an early_initcall, the failure doesn't actually prevent the driver from loading. There are other functions that rely on fuse->base staying around to access some of the registers in that I/O memory region. I suppose we could remove the -ENOMEM return there and instead just skip registering the nvmem cell lookups, perhaps that would make this less confusing. Thierry --JEhcvQN4vxPMMub6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAmBwO1IACgkQ3SOs138+ s6HxyQ//fisnmhmU+khbPxMFa1WltzGymagZoEzPoW3Nctn24xJpXCcjPMTm13Jf z+Ftc6geKqMYBy7cNMcMx3Esq7eb/ioBxwbAPME5kwSe+/95YTjRl+0lgCcrhKAa xJPFrhXmlMlc/GOdgP4Ahjv7hI74lVm7QZ8zfBqaZm73+9QsyFE4muXjjzVgRWyf QSTKa9lZxk191b7HtzcMskfr4bakwJP5DTOr9FEv6gLxUkv5O13uJ2nd5XHbyi2+ VKS+KUl+hf9VSXoDau3WflSzH5yR+aK9GQpiEORiynnB/gbSvg/qiY9IetfHYWxb EZcSNnr7WqB8skjDKsA8CwkTujCVUVSuFWj37Opm3U8pOwYnV2AAvNGklklrC+AK Be8jFh2UI3SXxQWWCMSPwp6OKnrvGcHyoXkEDhyRyFbT3+7T7TdUydXzJmnp/i61 GUoh98YfAPLBh76tYp7NyuQWlzqZjNb9B4J6CRdlOZQY7kJT+0eOKFU/8a0vxP9U pF29vQBmU2bRx1vCso0PR4k1uzuhx6ppNGXnFT580oU8U5a9E1xdBJp94EtQKPIr FRWlpijEiH7LxvCccRRft5I9V/2dczSQuzsVNxSZxLLWrB6k70cE1BCmfcvh+K+c 02l5Sf2AkMRWXkJ5RMMkuwT1B9SiO5S1736QKJ3Yxu+3dwSiILk= =wVmr -----END PGP SIGNATURE----- --JEhcvQN4vxPMMub6--