Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9098697pxu; Mon, 28 Dec 2020 06:36:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+DAdZYJxrkZuGQ0v/UHG6f1m6FOdPaHeGfnWMjk/iVvf/49DrfoAav6/46IiMLX9g8S9q X-Received: by 2002:a17:906:da08:: with SMTP id fi8mr41823638ejb.517.1609166184149; Mon, 28 Dec 2020 06:36:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609166184; cv=none; d=google.com; s=arc-20160816; b=WcQlRYj0uwk4jmnF6GASJw10LCnDJI4HzSU+g61HMH1AsyphIHQ2Mxs0ua9RXyNoou LoM0dAx94tio1yl/wvKcmdDuIWnQHySj71QaAJbbzmGXf0AfYin8CCWfLlHGRsy2qLU5 QYNgTkITYxr1n7OB727CVTvY3v0QRFHoJw4cdbQBdjZ2mMWarS8MGV1ECqau7EvCpurT 8AS2Z+i5c6Q1qwmTUL8gCHA2piW3TYk0R63eKl+VqqvP82kW9kvC+8qZxAjyuh3GamLK nLabM7tew3RXFwgxs5o/Znt2fMDu04rgTmp4ydnyQMuYMAVpDCgUFtyospSC8epTUe2P oNsw== 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=zO1gnab0qoQsTJiURBWK8Fwck/CNJm1Ip8pV0spzz4c=; b=q10UlPJGL0LalIfooOaCDOc+CEWSPiNY4MTsEYLzx6IbIjkMyl2LvG9KLwA8y6+h3L Rvnoo3kVWFVsGyT95C98PyILLAetpkGyUG2yv3fk8QDk9FK+ZC16RwYCqP101HZJPDmE EiHrIMLsPaqfCZhmdV7OdUX20nnSi6wf1qmKWsQ1M+F/SW/kBFwGp1+eVBjMQcNxcQ8N ipwjcPJvcJu1RG/OgPKMyieKiTBfd3NavH+3irTnnnC0l+XKe62c8vR4Fmf4xhc4rHrd sHtKPM4AscOX9Kaf+DlzVyd989gUzcDdQU483OcBNxeGY+SZxK31bgUaU966awpwzgKT gcvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OhDi2TtN; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y2si18386683edw.306.2020.12.28.06.36.02; Mon, 28 Dec 2020 06:36:24 -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=@linuxfoundation.org header.s=korg header.b=OhDi2TtN; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2504816AbgL1Ocs (ORCPT + 99 others); Mon, 28 Dec 2020 09:32:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:40036 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2504637AbgL1OcO (ORCPT ); Mon, 28 Dec 2020 09:32:14 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id ACD0620731; Mon, 28 Dec 2020 14:31:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165919; bh=aVRzW08YkAx8xT5rReD7QzmB1/2mc4eTf5Elk/gwka4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OhDi2TtNJF1xoLmxrMkugrZOS2Kv+vwACDqeXxi84dA/lfuyCBJmiNez1vDAEktMJ m1unc5fqDoEBHEDtDbzFVTD64J+7XoyIRW8EJS/KTYwoZQSGnTaCGoEQkINnQechc/ YPM6zyd44AsIdmBlAwmhIzWRivjNVtdtP2OnTogg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Paul Cercueil , Krzysztof Kozlowski Subject: [PATCH 5.10 701/717] memory: jz4780_nemc: Fix an error pointer vs NULL check in probe() Date: Mon, 28 Dec 2020 13:51:39 +0100 Message-Id: <20201228125054.567961515@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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 commit 96999c797ec1ef41259f00b4ddf9cf33b342cb78 upstream. The devm_ioremap() function returns NULL on error, it doesn't return error pointers. This bug could lead to an Oops during probe. Fixes: f046e4a3f0b9 ("memory: jz4780_nemc: Only request IO memory the driver will use") Cc: Signed-off-by: Dan Carpenter Reviewed-by: Paul Cercueil Link: https://lore.kernel.org/r/20200803143607.GC346925@mwanda Signed-off-by: Krzysztof Kozlowski Signed-off-by: Greg Kroah-Hartman --- drivers/memory/jz4780-nemc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/memory/jz4780-nemc.c +++ b/drivers/memory/jz4780-nemc.c @@ -306,9 +306,9 @@ static int jz4780_nemc_probe(struct plat } nemc->base = devm_ioremap(dev, res->start, NEMC_REG_LEN); - if (IS_ERR(nemc->base)) { + if (!nemc->base) { dev_err(dev, "failed to get I/O memory\n"); - return PTR_ERR(nemc->base); + return -ENOMEM; } writel(0, nemc->base + NEMC_NFCSR);