Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1775685pxp; Mon, 7 Mar 2022 02:02:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJyTB7lSechiZH9znrw3nkDBGihxTe+XhhkIwJJDEmvQMi0+thFsKD6jEacZq/vy/h6zsTsd X-Received: by 2002:a05:6a00:139e:b0:4f7:1576:f8fb with SMTP id t30-20020a056a00139e00b004f71576f8fbmr764953pfg.85.1646647369919; Mon, 07 Mar 2022 02:02:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646647369; cv=none; d=google.com; s=arc-20160816; b=gaDW2ZWnpcHDyCynexJxHw2tR7IpNh2C8RQOuTj5rTcd73OjrrPcEANOTx1YRrF64w dtoHCW1W+ISRMM8JRL6IsfGFOn5ScddyyIQkspflVXYF5gQlKHuoYr6xNQWkIOdmgeUq i4krZvHtFqrypbNBj2ur0axGU7Tp34VoVNhRdc8fQRmeL2OYg6Eqmnr3VTjN8YjNlg9b bas+BjzImvAJDNuv+sJmCJFeHKLQtSya2sg7oGbGV0V79E5DAarZt1RSUbwX5TSstF75 D8tCs3HgSP5JsdhYK9aRxAN0xn6DewsZlhipvLEAoR9C2STIqIgEh5R4xyQ7uGA6ziEP O/wQ== 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=ZvQvT0l9pbRP1N17fu6hR73C5FRhyXRXfLHs1OYJfB8=; b=fJtUvQBMqbYbqfouQswLCabUMdYffX0zXUtAKrUR6NMM2y1rMPA4BEEjtbQmfC1kmq OcZymX6jn3T9zpE4UzfIiV5jdzyHZQ1axWwWmSguerKZmhgIyJT7qGdiYSDu9u6X0pav Fh2ODKH+E5pVMwFJH3ZjSYuOggRs5oN/6mbGxWC9myl9wo5x9abTreUSR1PPawEy4M5n 2qcPhQ4mVczIAUK3jdCTjMwU60J9gYoCaYjUH8pLRun9kuTaWKvrYNVanm8vPs64QbE8 Sbh3T3OyWKDxRdeIwIABVKQJ/K674CkMalke9XRlG1Ce7TKtV/Ghfmr25iimYug30GI4 boDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jT4a5GEA; 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 y1-20020a1709029b8100b0015182f9482esi10959480plp.63.2022.03.07.02.02.34; Mon, 07 Mar 2022 02:02:49 -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=jT4a5GEA; 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 S236892AbiCGJ0C (ORCPT + 99 others); Mon, 7 Mar 2022 04:26:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237325AbiCGJXo (ORCPT ); Mon, 7 Mar 2022 04:23:44 -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 F1B7E3AA63; Mon, 7 Mar 2022 01:22:38 -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 845E261027; Mon, 7 Mar 2022 09:22:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EC55C340F3; Mon, 7 Mar 2022 09:22:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644958; bh=8HVQ0bK50UVVZlUYGGpvPde5Jchndo2Q57B4WADFTzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jT4a5GEADtID+u7evbBD1QQojYcW/jdnQaRYP1hHCjp9FpbbtfW0P0LTXWoJ4qyt5 SsqVxcbPPU3UOIB91vIlYNabFC4Bj+8po45kCwhV4+Htmjp4d06Ev6kl9goSpSzg1R UR3Eyc/wIQ6myr5ePmBxWfP0jlYdpp5Hbpq2IKuU= 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 4.14 35/42] soc: fsl: qe: Check of ioremap return value Date: Mon, 7 Mar 2022 10:19:09 +0100 Message-Id: <20220307091637.174000208@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091636.146155347@linuxfoundation.org> References: <20220307091636.146155347@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 7ae59abc7863..127a4a836e67 100644 --- a/drivers/soc/fsl/qe/qe_io.c +++ b/drivers/soc/fsl/qe/qe_io.c @@ -41,6 +41,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; num_ports = of_get_property(np, "num-ports", NULL); if (num_ports) -- 2.34.1