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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1ED8C433EF for ; Sat, 23 Jul 2022 09:10:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235137AbiGWJK1 (ORCPT ); Sat, 23 Jul 2022 05:10:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231272AbiGWJK0 (ORCPT ); Sat, 23 Jul 2022 05:10:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C59B7663; Sat, 23 Jul 2022 02:10:25 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id E1790B82C18; Sat, 23 Jul 2022 09:10:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94BB2C341C0; Sat, 23 Jul 2022 09:10:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658567422; bh=vFrd/H8zW4hCO4fFUiAu/WJ/KqGbXHTrFQ20cwdiKCE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Fk4w3UlWVXeaErCqbjt+L1lf3ygfMwvG4KgK/LGA1nccvWXfeAYTCxsnkLbsJSBm7 koBfAYJLeVULaFz4ZBUCpy+xq5P0rzmYnbQmsEXctvI7uWvzD7/b160oSo2z8Sw3mo hywOITj6Ws8+O6TthsGnXi4B2xMVYqoM0d8FyatefkUpgU/CSwiXJLIgh99vnLq+yk RFWgvbC6TxwBO1Hkw3PLt4VdyqSv3+zpUd92OuZhQtkYN5rTzgRmMcLXfzNTVIGbUr xLAhAK9DtYSECYHix1ylbx1jxHqUjrpQDXjNT02h1taJYmDsI3IAd9pifW9tfHfOKC IqUR7MJpHlJWA== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1oFB9Q-009Vj4-2V; Sat, 23 Jul 2022 10:10:20 +0100 Date: Sat, 23 Jul 2022 10:10:19 +0100 Message-ID: <87h738xkhw.wl-maz@kernel.org> From: Marc Zyngier To: William Dean Cc: williamsukatube@163.com, tglx@linutronix.de, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, tsbogend@alpha.franken.de, fancer.lancer@gmail.com, Hacash Robot Subject: Re: [PATCH] irqchip: mips-gic: check the return value of ioremap() in gic_of_init() In-Reply-To: References: <20220722091008.2937238-1-williamsukatube@163.com> <87mtd1y02y.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: williamsukatube@gmail.com, williamsukatube@163.com, tglx@linutronix.de, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, tsbogend@alpha.franken.de, fancer.lancer@gmail.com, hacashRobot@santino.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org On Sat, 23 Jul 2022 03:57:18 +0100, William Dean wrote: > > Thans for your advice. > > > Erm... No. The issue was definitely there before (just look at the > > patch you quote here). > > Do you mean that I wrote the fixes-tag wrong? I just checked it, it was > introduced by the earlier commit fbea754123ae5d9678295398c98e91f1b2159e5b, > if you mean that, I will send patch v2 Not even that. Here's what this patch has: - mips_gic_base = ioremap_nocache(gic_base_addr, gic_addrspace_size); + if (mips_cm_present()) { + write_gcr_gic_base(gic_base | CM_GCR_GIC_BASE_GICEN); + /* Ensure GIC region is enabled before trying to access it */ + __sync(); + } + + mips_gic_base = ioremap_nocache(gic_base, gic_len); gicconfig = read_gic_config(); gic_shared_intrs = gicconfig & GIC_CONFIG_NUMINTERRUPTS; Still no check for the ioremap result. You can actually trace it all the way down to 39b8d5254246a ("[MIPS] Add support for MIPS CMP platform."), which introduced that code initially. But is it worth referencing such an old commit? No. To be honest, given how early this code executes, failing to ioremap something is utterly unlikely, and adding the check is mostly about being pedantic. It is also worth noting that most of the use of this variable are guarded by mips_gic_present(), which actually checks for mips_gic_base being NULL and that the driver actually *ignores* such mapping. Given that, I'm not sure this deserves an actual Fixes: tag. This is completely harmless. Just resend the patch with a correct SoB, and I'll queue it. Thanks, M. -- Without deviation from the norm, progress is not possible.