Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6935433rwb; Tue, 22 Nov 2022 22:55:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf6BpipJaRe+8dWzuQVtYBzWbUb+I8rtPLhDtOw2ufRpK8EVExPPdKOJ2cvacTGfe9YMNNB5 X-Received: by 2002:a17:907:c24a:b0:7ac:2e16:bc31 with SMTP id tj10-20020a170907c24a00b007ac2e16bc31mr22325314ejc.242.1669186513266; Tue, 22 Nov 2022 22:55:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669186513; cv=none; d=google.com; s=arc-20160816; b=PrzlP4mV9qxwuc8/rTX7nPeEfdiWzq4TDbh38A6uQG+a98g8hKk+nLIC+2+BNyKMgd ORSpq/VW/Ci6Ai3kn0dpnUApzyxPCbY/Ii66HhP2GjLYVcy94lGTMqOd+U7xuQvVgZC8 1LkQS7yHolUqYratCJ5NfYzd09K0SZc2oHTfCKXwuGruO3D7XvJ5SQYHfHIhkC3Mok5W p1178fmnPqKi4Z74yGxducyQw32rmkrjk5P21Z/QfD3Ol8ltflFJS8fLHWVlkTY6BqdB JOmKqb/2gGmwhMBEba5P+SdGJw848B3pkCeMi//jjKFDMWjTvs/SaSS/D2LJ98AY4nLh 3MJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=gv7JSxcWkY7LnVYP27gZj0GEOZmbt03e7DqZmf9k7po=; b=ASZiEjt6fNDj3k6GYBI0bonmYxba1HD7Z5OXNQ1Y9WeDNzvgBe/8kxlylecro1Bmsa Fu8CnfHf+Tk2pzU9JYYFSpxv6Ut9yXUaO/kskN0/5/sk8dVQLzTwev38dsGHBjhXLC+a toe5DZN6Z2Ggj2qOyfLhL9KTy4XeD48y5/izhKkaKSBC+Kp2qwPCt3bLhp2f4lJktH5z Opvs81Kpgrzgq9m0rNBAXSY/PM/GDqF30JszvKPDuU4TbseAFpfeDTg0nrG0mGgJLKxu c9hrZ10Ugwkds4IRRZQZZnNV/bIzuILk7T24olqRk0baIHFc+c159rIQmMztcviupsj6 6u4A== 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 l9-20020a170906794900b0079ddb52369bsi3617672ejo.61.2022.11.22.22.54.49; Tue, 22 Nov 2022 22:55:13 -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 S236061AbiKWGo2 (ORCPT + 89 others); Wed, 23 Nov 2022 01:44:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235464AbiKWGoZ (ORCPT ); Wed, 23 Nov 2022 01:44:25 -0500 X-Greylist: delayed 434 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 22 Nov 2022 22:44:23 PST Received: from cstnet.cn (smtp23.cstnet.cn [159.226.251.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8A345EE0B; Tue, 22 Nov 2022 22:44:23 -0800 (PST) Received: from localhost.localdomain (unknown [124.16.138.125]) by APP-03 (Coremail) with SMTP id rQCowACnr5eEv31jzLIjAQ--.14755S2; Wed, 23 Nov 2022 14:36:53 +0800 (CST) From: Jiasheng Jiang To: rcsekar@samsung.com, wg@grandegger.com, mkl@pengutronix.de, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] can: m_can: Add check for devm_clk_get Date: Wed, 23 Nov 2022 14:36:51 +0800 Message-Id: <20221123063651.26199-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: rQCowACnr5eEv31jzLIjAQ--.14755S2 X-Coremail-Antispam: 1UD129KBjvdXoW7XF4UtryUCF1ftry3JFW8JFb_yoWfWFXEgw srZrWxXw1UWryIv3Z8ua15AFW5tr1DuF1vqr4kArZxta48Cw1xJFyIvF13urZ5Cw4jg3sx CF97ur95Ar4rCjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUb4kFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr0_ Cr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_GcCE3s 1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0 cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8Jw ACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2Y2ka 0xkIwI1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67 AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIY rxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14 v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8 JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjfUoOJ5UU UUU X-Originating-IP: [124.16.138.125] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 Since the devm_clk_get may return error, it should be better to add check for the cdev->hclk, as same as cdev->cclk. Fixes: f524f829b75a ("can: m_can: Create a m_can platform framework") Signed-off-by: Jiasheng Jiang --- drivers/net/can/m_can/m_can.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index 00d11e95fd98..e5575d2755e4 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c @@ -1909,7 +1909,7 @@ int m_can_class_get_clocks(struct m_can_classdev *cdev) cdev->hclk = devm_clk_get(cdev->dev, "hclk"); cdev->cclk = devm_clk_get(cdev->dev, "cclk"); - if (IS_ERR(cdev->cclk)) { + if (IS_ERR(cdev->hclk) || IS_ERR(cdev->cclk)) { dev_err(cdev->dev, "no clock found\n"); ret = -ENODEV; } -- 2.25.1