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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8B82FC4167B for ; Wed, 29 Nov 2023 17:16:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1p2gMhXId0IWp5xC9hBQpOEqLDuYLB5G4WS8labCmqE=; b=A+yXxH3802/A1I eKkCB/9MuDMrKBCQcMLkQjOC29jUnlStCtc7OVqc1jggA+pkbeXorSJRPusDVKhIZmpI8ey5jNNBP afblfN65vCWmLV522uWGarZ7MYIqPMEZcNBD2d3PemNxtSXLhj8GITnk/Xsa9OIkpow9RM6j/RCSa 3LlkwdneElNkb5Zd1ak7vlsU7A9jkaEfO7Lnh332CFZHiy9iJjFBoXvdbZBxh9sn60A5dlb6KjArj Hrr9WdFtjUS9CAhww7dPgtXcvHWTJqGO1FgzcPYp9kwd6Cc9xy9Gg50u9/dSjjra0uaBwU6q+eB9S eQuPoxWASBP7CtJ0Eyag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r8OAQ-008z1Q-1K; Wed, 29 Nov 2023 17:16:06 +0000 Received: from relay4-d.mail.gandi.net ([2001:4b98:dc4:8::224]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r8OAN-008z0w-0P for linux-arm-kernel@lists.infradead.org; Wed, 29 Nov 2023 17:16:04 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 5C662E0004; Wed, 29 Nov 2023 17:15:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1701278156; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fi6pfw/YrdlpRPQlqpuxTgYt0q8n78JWGSCcDcbp5EI=; b=i4pse/XMReNnftJ2DWqBLM7jpvYxZPwRWmWUEakFhPmk2HCamL/ds+2m58H3Ce/FcdkE+f S+20MoxlcdoyCAIf6H1l6po+cFGyUk/3AOpPXeLp4PPTay1ItCwJ9O0H1SA5KJ7WUl5isz 21iBx0ds/o/eeE2p2AX9bKDkREHNqrbHXhmKfEgcs+3MdPFfxHCHYneAAX8kFuikjYjhxA Mo2YrbnP/BnbOxS9xf41dmjT3mDAwRmeI8CG7DT+Dt2sJcTpJV0Kw/r/We9vnPGLKlXdmt x6ZWVhtk0y8ydlfh9qUfIYLqU/enO6Nw/n3iD3xVle2Md8ZJIWq2oyiuH0anig== Date: Wed, 29 Nov 2023 18:15:55 +0100 From: Alexandre Belloni To: Haoran Liu Subject: Re: [PATCH] [power/reset] at91-sama5d2: Add error handling in at91_shdwc_probe Message-ID: <20231129171555abae472b@mail.local> References: <20231129132939.34047-1-liuhaoran14@163.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231129132939.34047-1-liuhaoran14@163.com> X-GND-Sasl: alexandre.belloni@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231129_091603_329062_0DD26DC9 X-CRM114-Status: GOOD ( 17.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, sre@kernel.org, claudiu.beznea@tuxon.dev, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 29/11/2023 05:29:39-0800, Haoran Liu wrote: > 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) { Can you elaborate how this will ever happen? > + 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 > -- Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel