Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4585022rdh; Wed, 29 Nov 2023 05:44:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IH67Fi91agEhOSNHG1qO8f7XO6zHj11fEjrP/Ul4Z8OlGeHlhjqlsxn8MftxOVmjNAXhMlw X-Received: by 2002:a05:6808:1456:b0:3b8:339a:9a85 with SMTP id x22-20020a056808145600b003b8339a9a85mr27078649oiv.5.1701265465946; Wed, 29 Nov 2023 05:44:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701265465; cv=none; d=google.com; s=arc-20160816; b=WgD/2n3Lg+ktOLXObgmeRg7p0ap/bPWW7G3Dr4LSk9xoLyBzZWDq/OUu7e9hv6mCH6 Mfvr2JBheP/AbSvWLep0aUxTkipvged/t5a8annu0Pqf9rhEQvQR6OB2zKQ1AGyFckLE efscdenKqObxyVh/toQ1vArn01IjVN+UmZe7fAOWFiSj0U4PRtkX633TO4ZOcifbbjwB lggFhX1XiVyLrqRP5eF5cd5i/Bc6EpBeidZBIrMvIQmzUxdsWSPPLe6tLpd46AEb9pc8 ga6VQ1qxJU2DAZGakoHLmhfBYx9Vlu9tK1mD1EROZ7AvfHd2N2F6QEYp7w4BNG83mXf1 85JQ== 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 :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=/Fvbt+m5czYjaimHs1J7TeX90M7VaaDrm7+RR4MBqRk=; fh=yXz1nWzl8XP6moOT3dXqIVXcrO3qr2ryFnrDdKUXcoQ=; b=jtI1EIfQiWW5GMr3DIgmp3eVoXVD225MzqXQa8iCwzhnIfK6A83QnNNlZeMZ9iL17J vMsa5AyklS8obYk1Z3qflWFbDC7bBNdyXmwofLuBLQz1ngeuMsNKD/Mif0RT/KjNqmdp MrOcycCuT+8kKFA8ycTiLu+ZsfyKv3YjmeJ1he69ZTHElPwOnhAf/qEVah5zSl/95GEZ IlsdNZVp0WT6ftRW98rtaaJJI3yNp0j0UYZ4rn9yA5G26Ly5dE/5hf96ei74iYwwrdV+ maAflLzmLNaTvIDKsMQwe6VsXkTr9yD9awz8owZUAsBcMO3pyYa1wId0NXlIFkRMB3rf /7Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=1BHHaUu4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id v186-20020a632fc3000000b005bdd8af5a15si14023000pgv.668.2023.11.29.05.44.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 05:44:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=1BHHaUu4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 6F35D822B701; Wed, 29 Nov 2023 05:44:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234016AbjK2NoJ (ORCPT + 99 others); Wed, 29 Nov 2023 08:44:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233837AbjK2NoI (ORCPT ); Wed, 29 Nov 2023 08:44:08 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81BF8F4; Wed, 29 Nov 2023 05:44:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1701265450; x=1732801450; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=MPlGQDXLTd4g2qaz2Drg99hpErHK5vbwa9rvZksvgm8=; b=1BHHaUu4ym6c1Tm86FCZouFQlRCORCVjZFtA41Rcjz9349znlv9tbs69 yyuXRHQVXM2OXHiEcGGM5A1RTKAlNdFWZiYdHuqMRGsO4HIhtdd9NuvDa 9f0k3sH9+tLRT3xXI4fCgFgmFzCr1X0xNe5WF4w1xDaKTCs7dfW8FfQop fH9B3CIszvVe3mlv4Qba88ZrHUXOV966E7sltGrpxp43xDnUl1GC5vcxR kLV0LwZORITzlJ8hQWnMvoelKAzf4WqbUPuOWcwMuMiovav1KnYvH43/D VyFIi6tnP+x3KORbM9fyuymKcAhbBdMWFzJp2D4NG1F1RcxIRVrQZk5fS A==; X-CSE-ConnectionGUID: 508zqXykQuqczyZSlLqfIA== X-CSE-MsgGUID: MRF+HdceSYyZw6F0mq3Sjw== X-ThreatScanner-Verdict: Negative X-IronPort-AV: E=Sophos;i="6.04,235,1695711600"; d="scan'208";a="13257623" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 29 Nov 2023 06:44:09 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Wed, 29 Nov 2023 06:43:50 -0700 Received: from [10.171.248.81] (10.10.85.11) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Wed, 29 Nov 2023 06:43:48 -0700 Message-ID: Date: Wed, 29 Nov 2023 14:43:10 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] [power/reset] at91-sama5d2: Add error handling in at91_shdwc_probe Content-Language: en-US, fr-FR To: Haoran Liu , CC: , , , , References: <20231129132939.34047-1-liuhaoran14@163.com> From: Nicolas Ferre Organization: microchip In-Reply-To: <20231129132939.34047-1-liuhaoran14@163.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 29 Nov 2023 05:44:23 -0800 (PST) On 29/11/2023 at 14:29, Haoran Liu wrote: > This patch adds error handling to the at91_shdwc_probe function > in drivers/power/reset/at91-sama5d2_shdwc.c. The function As the platforms are DT only and that this driver was instantiated precisely because a "match" existed, I don't think this error handling is needed because it cannot happen. > previously did not handle the case where of_match_node could fail, > potentially leading to unexpected behavior if the device tree match > was unsuccessful. You didn't say how you reached this "unexpected behavior": is it a real case (I'm interested in the boot log then) or found running a static analysis tool? For now, it's a NACK, sorry. Best regards, Nicolas > Signed-off-by: Haoran Liu > --- > drivers/power/reset/at91-sama5d2_shdwc.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/power/reset/at91-sama5d2_shdwc.c b/drivers/power/reset/at91-sama5d2_shdwc.c > index e76b102b57b1..2ac566c83aec 100644 > --- a/drivers/power/reset/at91-sama5d2_shdwc.c > +++ b/drivers/power/reset/at91-sama5d2_shdwc.c > @@ -353,6 +353,11 @@ static int __init at91_shdwc_probe(struct platform_device *pdev) > return PTR_ERR(at91_shdwc->shdwc_base); > > match = of_match_node(at91_shdwc_of_match, pdev->dev.of_node); > + if (!match) { > + dev_err(&pdev->dev, "No matching device found\n"); > + return -ENODEV; > + } > + > at91_shdwc->rcfg = match->data; > > at91_shdwc->sclk = devm_clk_get(&pdev->dev, NULL); > -- > 2.17.1 >