Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6485724rwl; Thu, 29 Dec 2022 13:55:05 -0800 (PST) X-Google-Smtp-Source: AMrXdXt4xl1WPqMMwyVF9jU9WuB1lpR2IPh2mzcqQayznSGHM/PkZRD2BHZvW1M2HW5TsCn55WzH X-Received: by 2002:a17:902:bf43:b0:185:441e:2d77 with SMTP id u3-20020a170902bf4300b00185441e2d77mr32902098pls.14.1672350904864; Thu, 29 Dec 2022 13:55:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672350904; cv=none; d=google.com; s=arc-20160816; b=dYviw5FEcguxuS9y7fm7IH64o2LWATSxuNNk6W19glhIokb8rDULNzD2Gk5BGN0pcz 0qMCSEGZplgoDA+SSQVDKJzI9wjyB9JLV3qQYUbmW7dDPVV8OdqG55dDpB9AkPs93tbz AHJ9QA2xsRroBnOifNsmRApIrRBCkiQAOKzgsvYDg81wNNRB1/1itGn9b4d/7+jFrbFT qqWbbIKcJhqSAktuELpsPuysnQ2TmQA/JKza+c+xoTG/3UeLYF7O6TYmEvbC4CCot43B kfw+QiCa3w1iUU87HAA/6qmLzXXCXfTfjPsmjgpw5zKFJt4nj44Soa4aukksESYOk6XM /V7Q== 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; bh=2pWT5RHOEiNbLnu+Hoo46ALBCMZ8ZiLtfSISE/lp4uI=; b=DuDTKC7fYYNIq7CS2/I+ntRmVpy6Euv7oMcXLQ49pbm0ngBHRuM+uARuGrmRkSKfHH 13yYQxe0miitA57WiwU7yQw0Tx3OXwU5SgBAqtm6CfghCMbay/oAgq/9nnuMfTi9oJm/ mvUtjqBMNO9+UENOgZLQlc3xPmlVruTGhHy8kff7ZWr1j+Wyr4/mXwk/Ya2KUpaEXb2g SGgcjCq956IA/GkFkkeuHwX2lEhlBd2+1LefRF4LNv9w/XPCZgKlqTXp+uhj+V1/BXLf 7mZcuZHPIu0sZ0pjrXtALC6suRXSJcFrco+0lkmnmU6GWwEqdF0Y63iP9q+92nbjw5Tb XTag== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z12-20020a170902cccc00b00189655d7144si20017816ple.161.2022.12.29.13.54.56; Thu, 29 Dec 2022 13:55:04 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233922AbiL2Vnd (ORCPT + 61 others); Thu, 29 Dec 2022 16:43:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230155AbiL2Vnb (ORCPT ); Thu, 29 Dec 2022 16:43:31 -0500 Received: from smtp.smtpout.orange.fr (smtp-16.smtpout.orange.fr [80.12.242.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59AA110046 for ; Thu, 29 Dec 2022 13:43:27 -0800 (PST) Received: from [192.168.1.18] ([86.243.100.34]) by smtp.orange.fr with ESMTPA id B0gKp7mDjBicGB0gKpHr5U; Thu, 29 Dec 2022 22:43:25 +0100 X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 29 Dec 2022 22:43:25 +0100 X-ME-IP: 86.243.100.34 Message-ID: Date: Thu, 29 Dec 2022 22:43:19 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH] PCI: amlogic: The check for devm_add_action_or_reset's return value added Content-Language: fr, en-US To: Aleksandr Burakov Cc: linux-pci@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org, Yue Wang , Hanjie Lin , Lorenzo Pieralisi , Rob Herring , =?UTF-8?Q?Krzysztof_Wilczy=c5=84ski?= , Bjorn Helgaas , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl References: <20221220092137.6527-1-a.burakov@rosalinux.ru> From: Christophe JAILLET In-Reply-To: <20221220092137.6527-1-a.burakov@rosalinux.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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 Le 20/12/2022 à 10:21, Aleksandr Burakov a écrit : > The return value of the function devm_add_action_or_reset() was not > checked hence an error code would not be returned. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Fixes: 9c0ef6d34fdb ("PCI: amlogic: Add the Amlogic Meson PCIe controller driver") > Signed-off-by: Aleksandr Burakov > --- > drivers/pci/controller/dwc/pci-meson.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c > index c1527693bed9..3d82f0b65480 100644 > --- a/drivers/pci/controller/dwc/pci-meson.c > +++ b/drivers/pci/controller/dwc/pci-meson.c > @@ -187,9 +187,13 @@ static inline struct clk *meson_pcie_probe_clock(struct device *dev, > return ERR_PTR(ret); > } > > - devm_add_action_or_reset(dev, > + ret = devm_add_action_or_reset(dev, > (void (*) (void *))clk_disable_unprepare, Hi, using devm_clk_get_enabled() a few lines above would be IMHO much more elegant than these casts. This also saves a few LoC and avoid some other warnings/issues. (see [1]) Such an approach has already been used in [2]. Just my 2c, CJ [1]: https://lore.kernel.org/all/20221118233101.never.215-kees@kernel.org/ [2]: https://lore.kernel.org/all/20221202184525.gonna.423-kees@kernel.org/ > clk); > + if (ret) { > + dev_err(dev, "couldn't reset clk\n"); > + return ERR_PTR(ret); > + } > > return clk; > }