From patchwork Wed Nov 23 06:36:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiasheng Jiang X-Patchwork-Id: 24741 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2629521wrr; Tue, 22 Nov 2022 22:53:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf6sghcJ6UkrbQApL2gG5ExpLcPgvyp57g3ibeGs8RxmCvrzeXC4ojOZJX4LmYfhT9Y2c9RS X-Received: by 2002:a05:6402:5299:b0:461:7291:79c1 with SMTP id en25-20020a056402529900b00461729179c1mr14758342edb.68.1669186436498; Tue, 22 Nov 2022 22:53:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669186436; cv=none; d=google.com; s=arc-20160816; b=ak8Xqzszks0TWuVb3h1WN1XfGJj8dWkARBCBeXiJiZ9PoglzvsAe2SM/KtGT+IlReP zomz2DJopwO5QMpjhfABV8/+WmH9NZaaKla6sSEMO5aPT9wUcyyIQoUSxPkXsOZWPBCx HlODrip+nyOEqJ7MXNxMirl4du0PM+HWF6pHcpXbrpcqh39D+XQGZ/mJ9VCqMiKPYGBv SF/LTjQGDVB+ORumURwozQZAx6Z1BPW9iX6NyTZcFBNGNSsPtKc+h8j0w3KDA+aoQs2t D5n+B7GIhmzh6DHmUPYDYyxxXDS4zCuiJ2WtXIwRBd3Eb6XD8y2wGlju3CwqdPwHagWy UzSA== 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 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.53.31; Tue, 22 Nov 2022 22:53:56 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750268836849675399?= X-GMAIL-MSGID: =?utf-8?q?1750268836849675399?= 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; }