From patchwork Fri Mar 12 08:04:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 12133869 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAF97C433DB for ; Fri, 12 Mar 2021 07:57:33 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4185164F83 for ; Fri, 12 Mar 2021 07:57:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4185164F83 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=0moEzPC9+hmJ1TmCvaIRy2BKQBXF3S5nSBgbugwxiVU=; b=d6uelCAuRvXLhmAWM54EtnkoSi EkwnrI6L8EqEw01/ZSpPVzdsV+KzXBhCnUgiCDq+HkodhRQ/OWE+jvhy7m33PC+ar+cuRohL9pAHT Y2X6flSD6UyvsJGnNjUS/uJltOGOVXFSHC87QFGoWZE+TUfhmk2IB7PBNOYI5zCqDE9X+yqEQ+hBK PFw7/AUPYY6kV0mL9ARywyGJ8IPz9ZbjdV8xRVUprNdLtg3QC25bC2yiACVl8MFYiFJLhtlcpLXlQ 5lZ8gQh+dKVWrNwjXQ/w1vRPydABhy5Fw/yl9J+Ny3z357JkHb+Sk6dQ0cXIzRyKBKWd8Xzo1xDJp pKkRqtiQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lKceN-00Ap2D-Lp; Fri, 12 Mar 2021 07:55:59 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lKceI-00Ap03-N9 for linux-arm-kernel@lists.infradead.org; Fri, 12 Mar 2021 07:55:57 +0000 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4DxdNV06BWzmWWb; Fri, 12 Mar 2021 15:53:30 +0800 (CST) Received: from localhost.localdomain (10.175.102.38) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.498.0; Fri, 12 Mar 2021 15:55:36 +0800 From: 'Wei Yongjun To: , Ohad Ben-Cohen , "Bjorn Andersson" , Mathieu Poirier , Shawn Guo , Sascha Hauer , Peng Fan CC: , , , Hulk Robot Subject: [PATCH -next] remoteproc: imx_rproc: fix return value check in imx_rproc_addr_init() Date: Fri, 12 Mar 2021 08:04:20 +0000 Message-ID: <20210312080420.277151-1-weiyongjun1@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.102.38] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210312_075555_229173_7595A0A3 X-CRM114-Status: GOOD ( 11.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Wei Yongjun In case of error, the function devm_ioremap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Fixes: ecadcc47492c ("remoteproc: imx_rproc: use devm_ioremap") Reported-by: Hulk Robot Signed-off-by: Wei Yongjun --- drivers/remoteproc/imx_rproc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 5ebb9f57d3e0..3ba4b6ba47aa 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -464,9 +464,9 @@ static int imx_rproc_addr_init(struct imx_rproc *priv, /* Not use resource version, because we might share region */ priv->mem[b].cpu_addr = devm_ioremap(&pdev->dev, res.start, resource_size(&res)); - if (IS_ERR(priv->mem[b].cpu_addr)) { + if (!priv->mem[b].cpu_addr) { dev_err(dev, "failed to remap %pr\n", &res); - err = PTR_ERR(priv->mem[b].cpu_addr); + err = -ENOMEM; return err; } priv->mem[b].sys_addr = res.start;