Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3341954pxp; Mon, 14 Mar 2022 17:12:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgF7PvZU6WoFqPs9RBkA8PElUXw0MkAn8rFZ/5p9JjlVa24kx3sCfm7+aX1n44rK+AdnKB X-Received: by 2002:a05:6402:520a:b0:417:f20c:6b5a with SMTP id s10-20020a056402520a00b00417f20c6b5amr16001472edd.11.1647303121691; Mon, 14 Mar 2022 17:12:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647303121; cv=none; d=google.com; s=arc-20160816; b=WjEeCISjsXv1a7+zRB+4D5t+637O6MaSjj4TO4CwFbWg7dYNXnQR9bxf4Z8ma33dbV M3uFvdnO76RMWj25z9KGiCSf+RS5k7tU7PAi3y6BkCJuw4Epw6mEAvyZgQRXVU6HfX27 L3T3E+Y7kLMtMx8t4JahYtXC4LWYOgcqNuwOzMspbCCQCqUlhQfwKxFANdRr/REPqMfn r4pevPllq2i2clxYgRor1IcTNoY2EltW51qr+WZbqDYsO4WC/WZo9bgbsKEdFSQzqjKJ COH41OHINhMhLUvbvRxgzIJ8T3dClP3F1ySRncobuMuDvjMB4VpJ/QCULG3bjdFHdVZB uOYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=d/Zl5IT0l4GxJ3EjJL6DVxZWvh+do4XqDD23U9DbZgg=; b=UCEz9sMq460PYk9aZDlh7fwpbzizQJoeHipOxNvrhinRIvPPo3tsHx98nt4MXStBxs zErezvaw5Itfqb6ZxZctbyM9EpkmksJTG8DSGKThiYb+U1NJPpTgLVWImLRWQmSx0buf nQkA1EzK2YzypyaRQAgXr4FLWYUxP0be3DQ+CVNx0XCx44rqF8RJJuynpokwJPYsqg+e xwsrUo9oNrYFYS1OPClNgAPiAxECcF+PSUY7E4X8cR+AxYQrmBV0FrVQACm0HYo5dVFr E6U5/15RosXMgIpi+l3uO0xAvRbvpaxAnD37aUM+wllSHjt8R1ah6TF/ybtlwclJV6G+ 1cnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jekb1x+x; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 1-20020a170906318100b006cb8f7eadf0si10531577ejy.955.2022.03.14.17.11.36; Mon, 14 Mar 2022 17:12:01 -0700 (PDT) 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=@gmail.com header.s=20210112 header.b=jekb1x+x; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235397AbiCNIZU (ORCPT + 99 others); Mon, 14 Mar 2022 04:25:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231159AbiCNIZS (ORCPT ); Mon, 14 Mar 2022 04:25:18 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39E04DFC2; Mon, 14 Mar 2022 01:24:09 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id e6so19073029lfc.1; Mon, 14 Mar 2022 01:24:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=d/Zl5IT0l4GxJ3EjJL6DVxZWvh+do4XqDD23U9DbZgg=; b=jekb1x+xSCPoaVZdOGtvtnkt50ZAaEN27HK0Je+kfHmEcH/Nb5Wpt+xMDNZeBCoEf8 h86wS+ScdEpGUI+iaSeKOmjno4u2m5LYBGPOutdnup/+X41zgH2dciLKkdwBbnRLewCm jEL3iSX/gp78Z7h5t96/JEgarjlKvlXuNls5lH80FiEEEoqk/EBGCcTj02KO2A8EzKM5 mW1xiHBgj8V3Opi1NJ9VRg7F+DA5eHHBGmzUNFvIbgCgDW+0uDEZgKa+g9DrAHqAfb/G 50HPqXDChLWiUMMMYZ92PJYccNleApTRNksJfkgbqnyKOyzmf9OCLyr3fMZCgKJIgdpO bMjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=d/Zl5IT0l4GxJ3EjJL6DVxZWvh+do4XqDD23U9DbZgg=; b=nhN1ZehACzcLAEDnQkL26BeWemWm9h/FJda7OdAQKdviwvk0Nze1opTF4I0YEC6aus nl9b2Usiw3YCvEAsH3CBZgz67/TrBhsktpAvk1u49GorXSFk0NHXmsZxjYwfVYBguaX9 m+p1IAVh4UayMP1nsWhebdMLdAErXWJLJuzsXk/9lcZ9XO0p9dPPuxQYudWM2PCubw1P yPKsodBNE0XI7Q+a5Lo6jnNZROvNt2IGx+9Yvbzw+U4WREgIJu8CznEcntXF60JVluil l9kzbnObi2d2BK93DOVPlvFIvfz5e0QcYZCInQkokFTFeuwTKdLpj6gRem9eQp84C4FW dc5A== X-Gm-Message-State: AOAM5306Jcz6OPFHI5nFmjAq2La7bjL231FS91MtIGVjH/OCJJqgpOvL TKYQ4MvOjAbCvfFO0IWMvln6aDZIujErIzKVbWQ= X-Received: by 2002:a05:6512:3a8b:b0:448:30d6:a73c with SMTP id q11-20020a0565123a8b00b0044830d6a73cmr12806889lfu.393.1647246247341; Mon, 14 Mar 2022 01:24:07 -0700 (PDT) MIME-Version: 1.0 References: <20220311014245.4612-1-ctcchien@nuvoton.com> <20220311014245.4612-4-ctcchien@nuvoton.com> <1f5e1e49-4ab0-5e06-fa8f-2a11b0fd1df9@canonical.com> <4f8fffa7-631a-9b87-ee0a-0fb7dc1fec66@canonical.com> In-Reply-To: <4f8fffa7-631a-9b87-ee0a-0fb7dc1fec66@canonical.com> From: Medad Young Date: Mon, 14 Mar 2022 16:23:56 +0800 Message-ID: Subject: Re: [PATCH v3 3/3] EDAC: nuvoton: Add NPCM memory controller driver To: Krzysztof Kozlowski Cc: Avi Fishman , rric@kernel.org, James Morse , tony.luck@intel.com, Mauro Carvalho Chehab , Borislav Petkov , Rob Herring , Benjamin Fair , Nancy Yuen , Patrick Venture , KWLIU@nuvoton.com, YSCHU@nuvoton.com, JJLIU0@nuvoton.com, KFTING , Tomer Maimon , Tali Perry , ctcchien@nuvoton.com, linux-edac , Linux Kernel Mailing List , devicetree , OpenBMC Maillist Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 Krzysztof Kozlowski =E6=96=BC 2022=E5= =B9=B43=E6=9C=8814=E6=97=A5 =E9=80=B1=E4=B8=80 =E4=B8=8B=E5=8D=883:35=E5=AF=AB=E9=81=93=EF=BC=9A > > On 13/03/2022 21:22, Avi Fishman wrote: > > On Fri, Mar 11, 2022 at 11:15 AM Krzysztof Kozlowski > > wrote: > >> > >> On 11/03/2022 02:42, Medad CChien wrote: > >>> Add support for Nuvoton NPCM SoC. > >>> > >>> Signed-off-by: Medad CChien > >>> --- > >>> drivers/edac/Kconfig | 9 + > >>> drivers/edac/Makefile | 1 + > >>> drivers/edac/npcm_edac.c | 714 +++++++++++++++++++++++++++++++++++++= ++ > >>> 3 files changed, 724 insertions(+) > >>> create mode 100644 drivers/edac/npcm_edac.c > >>> > >>> diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig > >>> index 58ab63642e72..757e1d160640 100644 > >>> --- a/drivers/edac/Kconfig > >>> +++ b/drivers/edac/Kconfig > >>> @@ -539,4 +539,13 @@ config EDAC_DMC520 > >>> Support for error detection and correction on the > >>> SoCs with ARM DMC-520 DRAM controller. > >>> > >>> +config EDAC_NPCM > >>> + tristate "Nuvoton NPCM DDR Memory Controller" > >>> + depends on ARCH_NPCM > >> > >> || COMPILE_TEST > >> (and test if it compiles) > >> > >> (...) > >> > >>> + > >>> +MODULE_DEVICE_TABLE(of, npcm_edac_of_match); > >>> + > >>> +static int npcm_edac_mc_probe(struct platform_device *pdev) > >>> +{ > >>> + const struct npcm_edac_platform_data *npcm_chip; > >>> + struct device *dev =3D &pdev->dev; > >>> + struct edac_mc_layer layers[1]; > >>> + const struct of_device_id *id; > >>> + struct priv_data *priv_data; > >>> + struct mem_ctl_info *mci; > >>> + struct resource *res; > >>> + void __iomem *reg; > >>> + int ret =3D -ENODEV; > >>> + int irq; > >>> + > >>> + id =3D of_match_device(npcm_edac_of_match, &pdev->dev); > >>> + if (!id) > >>> + return -ENODEV; > >> > >> Why do you need it? How such case is even possible? > >> > >>> + > >>> + npcm_chip =3D of_device_get_match_data(&pdev->dev); > >>> + if (!npcm_chip) > >>> + return -ENODEV; > >> > >> I wonder, how is it possible to have here NULL? > >> > > Both of_match_device() and of_device_get_match_data() can return NULL, > > are we missing something? > > I think your driver is OF-only, right? If yes, how is it possible to be > here in probe() (meaning: being matched by of_device_id) and a few lines > later do not match the same of_device_id? I got your point, thanks > Best regards, > Krzysztof