From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6844AC43334 for ; Mon, 13 Jun 2022 11:29:25 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LM8VD07mKz3dw7 for ; Mon, 13 Jun 2022 21:29:24 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=nfschina.com (client-ip=2400:dd01:100f:2:72e2:84ff:fe10:5f45; helo=mail.nfschina.com; envelope-from=liqiong@nfschina.com; receiver=) X-Greylist: delayed 288 seconds by postgrey-1.36 at boromir; Sat, 11 Jun 2022 21:55:40 AEST Received: from mail.nfschina.com (unknown [IPv6:2400:dd01:100f:2:72e2:84ff:fe10:5f45]) by lists.ozlabs.org (Postfix) with ESMTP id 4LKx9S3wcZz3bxk for ; Sat, 11 Jun 2022 21:55:40 +1000 (AEST) Received: from localhost (unknown [127.0.0.1]) by mail.nfschina.com (Postfix) with ESMTP id EAF341E80D77; Sat, 11 Jun 2022 19:49:48 +0800 (CST) X-Virus-Scanned: amavisd-new at test.com Received: from mail.nfschina.com ([127.0.0.1]) by localhost (mail.nfschina.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZAWslLkv7asd; Sat, 11 Jun 2022 19:49:46 +0800 (CST) Received: from localhost.localdomain (unknown [180.167.10.98]) (Authenticated sender: liqiong@nfschina.com) by mail.nfschina.com (Postfix) with ESMTPA id D0A4B1E80D70; Sat, 11 Jun 2022 19:49:45 +0800 (CST) From: Li Qiong To: Qiang Zhao , Li Yang Subject: [PATCH] soc: fsl: qe: Check of ioremap return value in qe_reset Date: Sat, 11 Jun 2022 19:49:45 +0800 Message-Id: <20220611114945.24045-1-liqiong@nfschina.com> X-Mailer: git-send-email 2.11.0 X-Mailman-Approved-At: Mon, 13 Jun 2022 21:27:22 +1000 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: renyu@nfschina.com, yuzhe@nfschina.com, linux-kernel@vger.kernel.org, Li Qiong , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" As the possible failure of the ioremap(), the qe_immr could be NULL. Therefore it should be better to check it and print error message. Signed-off-by: Li Qiong --- drivers/soc/fsl/qe/qe.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/soc/fsl/qe/qe.c b/drivers/soc/fsl/qe/qe.c index b3c226eb5292..3c0948c2440e 100644 --- a/drivers/soc/fsl/qe/qe.c +++ b/drivers/soc/fsl/qe/qe.c @@ -88,6 +88,11 @@ void qe_reset(void) if (qe_immr == NULL) qe_immr = ioremap(get_qe_base(), QE_IMMAP_SIZE); + if (!qe_immr) { + pr_err("%s: failed to ioremap()\n", __func__); + return; + } + qe_snums_init(); qe_issue_cmd(QE_RESET, QE_CR_SUBBLOCK_INVALID, -- 2.11.0