Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3039210pxp; Mon, 14 Mar 2022 09:36:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbOspQEgNxEhRmJPHFy3LVC39f8Wdx/MFv/N2wTqN5RbWyCKSAQIdIwfwBpuwJ4+8ri0nj X-Received: by 2002:a17:903:2303:b0:151:d3dc:42b3 with SMTP id d3-20020a170903230300b00151d3dc42b3mr24633876plh.85.1647275775753; Mon, 14 Mar 2022 09:36:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647275775; cv=none; d=google.com; s=arc-20160816; b=fjxx/wtJAn5NT8DKR/X9L79mtpcNNqmXVCJdgYk8f8WNmJrby+6Z8+HKYC5U1+6RNH ltjv9mZm1cio6XtWp36ugU7kE5JzyAj3ohDSkWm20nC0DR679mb2rT+U/9wv4pT6rYbI zIUeaax7VlZ2RaibgUFDz1iLRMh2nEcHkhdUe8XmxKdpGsZOv0Lp+5TGg/ZbrfFjSL0j lcZdzubWIgpXp8JRE/U31S9Yn8JrIinbu2AzOSQd8zbA4SKjSZyGHWqNjzRn4JwYbcDb 3EowkrFOy3jW452+tIBj1I3pAEKrN1QxuDJlZ5fifO+iRMK18AtOmnbP9XXI84ZO3/HR Tzgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=7XD/ZCIPD+pSa/ajluyXSHrFnnLxPbj9dv4H6XXzi7o=; b=IlEVVG4TBUvKBy8aCbOH4C27JyO611UrbqrI7+tyq2bqCj7nGvJOhC2SQQC4JpCXiV xzqpWEENFxQtyrtvFlTB81f7eQIh9eBxDkf1XMtEFFALO6uCUOMgTCRME4x4SLSiylMG TaLy9jllFtOrCvW+GTLbzWU+q9vdH2RiQN5QyltkwchYu7zsH8DHsv+lONTwuSQJJVkM BT0/AzbsfCLHmisKnpxW6G2uR3v0vSDznrbPVziprbb7RmcNRv7SSQpqLstN7BJnQmoN dkMRQ6Gsjr7+7ibXPGbnkCnqXgee/StpqXjRsjuATuIwGmTC3KJjmv/TacF+c9LTey5n g8xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=RRjxuZri; 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=canonical.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 73-20020a62144c000000b004f6a320898dsi14250970pfu.289.2022.03.14.09.36.01; Mon, 14 Mar 2022 09:36:15 -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=@canonical.com header.s=20210705 header.b=RRjxuZri; 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235153AbiCNHge (ORCPT + 99 others); Mon, 14 Mar 2022 03:36:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229747AbiCNHgb (ORCPT ); Mon, 14 Mar 2022 03:36:31 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EDDA40E4E for ; Mon, 14 Mar 2022 00:35:20 -0700 (PDT) Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id B49AA3F62E for ; Mon, 14 Mar 2022 07:35:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1647243316; bh=7XD/ZCIPD+pSa/ajluyXSHrFnnLxPbj9dv4H6XXzi7o=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=RRjxuZriAsaR77So9xWe6U3lKguXv3h8zPlDoRWaGCNefBEj2hLvSsREqM4viYOna 4ax02wxx1bMBZ/0eSeoAatw5HU9rSkW2HY86ZeDuz/u10Oqo184enCuPAUDxegRywC 4DDB5qVlzDVl6cepdg1TqmTyERUwyuvLJJe8k0Rrr5VHdKktOx65Z85OTuIyII4lDG hrF9Jch2pR2Vh5jTjKYrH+JZvd7wxy3EvqNYHeM3pKDX1WLYXY97tmweNmljhCDZCi 1RmRMn3mDk65Q+cZepjqpHFgG19K2X1hhsEJcObiNFI6cmcS9TJWok1khtl2fgc29x 8wBk0NwPz2q4g== Received: by mail-ej1-f72.google.com with SMTP id hx13-20020a170906846d00b006db02e1a307so7526622ejc.2 for ; Mon, 14 Mar 2022 00:35:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=7XD/ZCIPD+pSa/ajluyXSHrFnnLxPbj9dv4H6XXzi7o=; b=OJcqg7MN1UiVRFe+Lgf8u+2FBIzjU5Fc570Vc3xvRI0lWvZ02ryvJRLqoVNEYsh4Xj nC7iyHLRl+iOpXMDj1K2Iu5rC1JpQbMOTVSbBj5E+S2lpZDH/kiPsSfH8k9qgzyKlaUS BhWTooOCG9tC04xi9FGeyEH9Bdec0Fwi5B41e7DOdCPJYL0yJCWz8TxUvEhDBuyTBYY1 H4wZJijk9uRAv4eGFQ+ObKbPHy+KWzV7NKvrre3pm/9JhzhVj598DuD0GUYlR1HvxBgc Idhk9zfMlePmIMajBDd0O/MMw4JwTPwNaxYSBDuM5jPTZh+Xhs3GpD7IRro0o5Ipe2Ql AQjQ== X-Gm-Message-State: AOAM533Pef5oz9X3L4NHs/rgbweIxorrhl4qJbw08uPoY4SwfzYSZnkJ 5Rgz602VkHL5r9+ZwoZYc8xAfZQt+g8GEimWY0wG1VQvvNwfRmxI8XiBt0fKc3Zl4jrrzkC67GA 9DoNR3v/0U4HgkdZO8cN1RlWCaW2eQ0OL+UsAJdDpRA== X-Received: by 2002:a05:6402:4301:b0:418:585b:cfe1 with SMTP id m1-20020a056402430100b00418585bcfe1mr9566745edc.250.1647243316376; Mon, 14 Mar 2022 00:35:16 -0700 (PDT) X-Received: by 2002:a05:6402:4301:b0:418:585b:cfe1 with SMTP id m1-20020a056402430100b00418585bcfe1mr9566734edc.250.1647243316197; Mon, 14 Mar 2022 00:35:16 -0700 (PDT) Received: from [192.168.0.152] (xdsl-188-155-174-239.adslplus.ch. [188.155.174.239]) by smtp.googlemail.com with ESMTPSA id l9-20020a1709066b8900b006daa6015a0dsm6336356ejr.89.2022.03.14.00.35.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Mar 2022 00:35:15 -0700 (PDT) Message-ID: <4f8fffa7-631a-9b87-ee0a-0fb7dc1fec66@canonical.com> Date: Mon, 14 Mar 2022 08:35:14 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v3 3/3] EDAC: nuvoton: Add NPCM memory controller driver Content-Language: en-US To: Avi Fishman Cc: Medad CChien , 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@nuvoton.com, Tomer Maimon , Tali Perry , ctcchien@nuvoton.com, linux-edac , Linux Kernel Mailing List , devicetree , OpenBMC Maillist References: <20220311014245.4612-1-ctcchien@nuvoton.com> <20220311014245.4612-4-ctcchien@nuvoton.com> <1f5e1e49-4ab0-5e06-fa8f-2a11b0fd1df9@canonical.com> From: Krzysztof Kozlowski In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,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 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 = &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 = -ENODEV; >>> + int irq; >>> + >>> + id = 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 = 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? Best regards, Krzysztof