Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4576425rdh; Wed, 29 Nov 2023 05:30:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IHkV2uv+cA42cc7vfDuGkU72+G3Voi0/UhfW4iVKAqKyEMwdbyNZNtLRzFz3SLh1ywUrnQU X-Received: by 2002:a05:6a20:8e26:b0:18c:abeb:b0db with SMTP id y38-20020a056a208e2600b0018cabebb0dbmr10355160pzj.49.1701264634753; Wed, 29 Nov 2023 05:30:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701264634; cv=none; d=google.com; s=arc-20160816; b=QBk+evSl6wuHoHUUdrroQd45EJqutiLuZWv18K26JhuKSfnLmqjf+BIk/suAWkFw29 k8aE2lENKvtFW8uaTBhuYIMqYkqK0TEhtAuD25gd335hz3O2Y4CAhIX80nbLdpM1AJBi Rrrx8W3PavxBRJdwhrmNvU2bdqFudIzVD1F1ECZ66qJB+m98yURn80r18VM12q8bPqat NecBGQnTWgNHVLJXApc0RUtFQiqavwcgy3dBMOIJ16tSUHZOLXIGrSjRFqmXOJ2CqDEn lPoRuHhx7awomb+3Z33NuMH6rOymXeaITO1xn0C6M2HNFG4l3YwGfDao+02DrUe/GZvK Xe6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=JmdW2UbTrTOnM62ANwuP4zK8vG4e8luOaqLCxOa+6iE=; fh=Gekoch42opUGcgE47ZNAorJyr4OvGL3r/6NCTvgEzwU=; b=u52PTUKOliS+NiIkVbKw58GPz1bKHix0GYuCHpOgiVJOrox2qF8XH3VwXwsFm4ed1S mX8kAwdXsbwmyJioQUpzx88gD0WFSCvXmv7E/Ozp7U8fRa/PuKGI3FcyyLItvHzFfIaf rqvZMuR8YD4ze5j36Za+/AqqC5DwO/74QXqMQbL3m0wYyVwVSRiMr0E2Ifac/iwll6k4 3FJ2BEqjyBNLydsqRQsiWstdMzPBt7UwqDAvHhQOZX4eOgXpH0nPp/RnBMNx7V8TabvT PRARHbjas4uoJDNikfMZ8aNhvi3GRPGhJaqDhdY3zc4QupK9DLPSdQlETmWfusZfqooi DoKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=lCt70qak; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id jc2-20020a056a006c8200b006cbeff62ca7si13972985pfb.49.2023.11.29.05.30.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 05:30:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=lCt70qak; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 13E1A80A5B51; Wed, 29 Nov 2023 05:30:25 -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 S233947AbjK2NaK (ORCPT + 99 others); Wed, 29 Nov 2023 08:30:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230437AbjK2NaK (ORCPT ); Wed, 29 Nov 2023 08:30:10 -0500 Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.198]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3F236A8; Wed, 29 Nov 2023 05:30:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=JmdW2UbTrTOnM62ANw uP4zK8vG4e8luOaqLCxOa+6iE=; b=lCt70qak/pKxGklw11WVuUaz8mDHx0oBkJ ITlE86LnkPfuf9V+QHYKWn6+FS7HHy6m9KaWQYPc0BAoOizXwFAy6ecjzfG6MYvD +sexrsV0sNZWil+pRJh8+/RefVIBy55LoAnJM6woHtqC1EwGXkeUO9hSjb0FsIZs nBV3nd+IA= Received: from localhost.localdomain (unknown [39.144.190.126]) by zwqz-smtp-mta-g3-4 (Coremail) with SMTP id _____wDXnx3FPGdlfoIgBQ--.49480S2; Wed, 29 Nov 2023 21:29:43 +0800 (CST) From: Haoran Liu To: claudiu.beznea@tuxon.dev Cc: sre@kernel.org, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Haoran Liu Subject: [PATCH] [power/reset] at91-sama5d2: Add error handling in at91_shdwc_probe Date: Wed, 29 Nov 2023 05:29:39 -0800 Message-Id: <20231129132939.34047-1-liuhaoran14@163.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: _____wDXnx3FPGdlfoIgBQ--.49480S2 X-Coremail-Antispam: 1Uf129KBjvdXoWrtr4xCw15uF4UWFW3WFWruFg_yoWkGFc_Xw 47AFWIya47KF1v9FnavwnIvrZ7CrnrXryDXF18tr93uryDWw4DtrsFvr4DXFs5Xa4UCrs8 tF4DtF4rZF1xXjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRMGYLJUUUUU== X-Originating-IP: [39.144.190.126] X-CM-SenderInfo: xolxxtxrud0iqu6rljoofrz/1tbiZQs3gl8ZaQ8awgABsi X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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:30:25 -0800 (PST) This patch adds error handling to the at91_shdwc_probe function in drivers/power/reset/at91-sama5d2_shdwc.c. The function previously did not handle the case where of_match_node could fail, potentially leading to unexpected behavior if the device tree match was unsuccessful. 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