Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1802245pxp; Mon, 7 Mar 2022 02:41:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJxThG7jOXOrMiYO0MlB3zkiGyHTjXFn3436bAeT1FSCQJHQ83+GeOYrNd14c+cWWhtJqn1f X-Received: by 2002:a17:906:3748:b0:6db:3859:dca7 with SMTP id e8-20020a170906374800b006db3859dca7mr1362901ejc.309.1646649687103; Mon, 07 Mar 2022 02:41:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646649687; cv=none; d=google.com; s=arc-20160816; b=dfCWkFB7vF0Q3Pa6Daq1EcqS47VpiF6ESJiPjehXBLgAB7QaohQPSdIgWxUXGeIVcZ EMK0hb52KvlpTS0A5I9A4Sj5SFR2t8lZXeQpaJ3EnDQe4R0SaOo3JRCdXhJjchFjpOqD 5jnBXodOlvvGhgcupf6ezDJCOI4fl3/IICdnjO/thXSnc46V6Ow+Ys3AZhTk3L3nsUZu hOVMaUTyIjLnJ6cRpbHU8EvKlIU5uWjQH4MoMeqMovDV04+S7i7IpBd5+vcQkXYo0KgK D+HHNq8ClbZXNu/4VSlqw5xs9fKrZH5AvyvBirXRGMbPx/WNrhr8/h4dnZvG104Hkgny e7iw== 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=8SHLCx3jt04Z1R/KNSKNfi3C1Y2dAxQI5qN7zKL3MYw=; b=RxekiuPRycExnSp+iR2aeqEpLjwbyG3cd+qjOs9KjEcLtEXz9AEpKBqGiIGzMuSxKl sp+1hb5M8Fta0Ky9JNc2SbDcaZofiE1wvBIkOTLSob0lj2H6HqDvhHzVTmTPTnn2h6gN Aq2kwAsdU7Z8OVievvkQIC/ofVMcDrqhUsafWZcyuItXxmP4SlHlWRmGTNuJn4vcCNA1 5w1Bg7kpR6SA2QwwtCy4tei2uDjMgVZibuLQtzSvKXvYcFHC2TYy1MU6eZG8dHobZsk7 a5rTzYy7yhCwTXYEpoh5LdpUpSQCg1x29c570+5uvJrI62mYOgWSliYJsFZFgsjlJn4I Ah5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d5dPDdmG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb40-20020a1709076da800b006dad70640casi6154412ejc.73.2022.03.07.02.40.55; Mon, 07 Mar 2022 02:41:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d5dPDdmG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S240150AbiCGKNX (ORCPT + 99 others); Mon, 7 Mar 2022 05:13:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238746AbiCGJ4u (ORCPT ); Mon, 7 Mar 2022 04:56:50 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E5BF793AB; Mon, 7 Mar 2022 01:45:54 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C9C80612D2; Mon, 7 Mar 2022 09:45:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4105C340F6; Mon, 7 Mar 2022 09:45:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646646348; bh=pQlJEJDvqtDu+suvKnjHMbbeU6Qxo+vHXTUbe6fe3vk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d5dPDdmGYMhQmBRq9tVcmfibdWOj8X8Ia1yLjEMs040ys+vKc8si76eEQGuyhD67S iWjglMV8yzmamujncjoV7xI7RvMABpfiavHADFC74iQT0xR7Zv0KXqstWSCuFWTgwR MzPFMjtuEZcB6VfXVEkpNiqCMcYMwYwe8RQhYz3M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Li Yang , Sasha Levin Subject: [PATCH 5.15 212/262] soc: fsl: qe: Check of ioremap return value Date: Mon, 7 Mar 2022 10:19:16 +0100 Message-Id: <20220307091708.884646150@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091702.378509770@linuxfoundation.org> References: <20220307091702.378509770@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiasheng Jiang [ Upstream commit a222fd8541394b36b13c89d1698d9530afd59a9c ] As the possible failure of the ioremap(), the par_io could be NULL. Therefore it should be better to check it and return error in order to guarantee the success of the initiation. But, I also notice that all the caller like mpc85xx_qe_par_io_init() in `arch/powerpc/platforms/85xx/common.c` don't check the return value of the par_io_init(). Actually, par_io_init() needs to check to handle the potential error. I will submit another patch to fix that. Anyway, par_io_init() itsely should be fixed. Fixes: 7aa1aa6ecec2 ("QE: Move QE from arch/powerpc to drivers/soc") Signed-off-by: Jiasheng Jiang Signed-off-by: Li Yang Signed-off-by: Sasha Levin --- drivers/soc/fsl/qe/qe_io.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/soc/fsl/qe/qe_io.c b/drivers/soc/fsl/qe/qe_io.c index e277c827bdf3..a5e2d0e5ab51 100644 --- a/drivers/soc/fsl/qe/qe_io.c +++ b/drivers/soc/fsl/qe/qe_io.c @@ -35,6 +35,8 @@ int par_io_init(struct device_node *np) if (ret) return ret; par_io = ioremap(res.start, resource_size(&res)); + if (!par_io) + return -ENOMEM; if (!of_property_read_u32(np, "num-ports", &num_ports)) num_par_io_ports = num_ports; -- 2.34.1