Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp533461pxm; Wed, 2 Mar 2022 03:42:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJyoeuD/a19nArqM+bYYYZ5OPyzI0WWagpscvY+2x+Drr6xfNRI0/gEiAqjeoZegVo8OEICp X-Received: by 2002:a17:90a:6508:b0:1be:d59c:1f10 with SMTP id i8-20020a17090a650800b001bed59c1f10mr9046314pjj.229.1646221335627; Wed, 02 Mar 2022 03:42:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646221335; cv=none; d=google.com; s=arc-20160816; b=0MpJD3m8g99YrUwg51RqglfDeoSyiNmNgnIuIF8OcI1scI1ZcjiV0HJTuh4qy+C1sQ bOcC6XS8oSQlp9WQL067+jKIqnb8jjBFArLEhsASMpfEKUysC7MLyLgubhC7S3ZJ8aLw yL+Xp3vb7dKGljUCwErs65gzYG0BbDVOR3Izoc9MxasTw5M4pM/u+b4hzKBY6BlNNVqi KUQAd/kC2dTkJITA/kO4F9iaKTpfgORXSouMr2+fe25rNghdV+/lqZMP0y5vl4uKl6lZ wJgxi5yde8tO9eHCl3aY/0j2zN0BV8cOplbHhJcLpDYzl/UQwxDlOpvMwouzoP4d3BcR oYrA== 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=MXOayydry2unCVBu+smF86hv1wpwuizLRTfb/+4fmeo=; b=0YWfKo8K5+yFWvxPvJgbAxSwxBJPtQWpgNU/EJAtTfca7habAVccSxnYY9yiz3DYei /9S7hPAiAFhXqwWeEq0wjXXbYYWmYSbKliwls14JvkPk3gugl5cIJgQgwjCp+OvPRSRz zCr2KA7E4d5FjLD+uT3Zh438K/Itjmn5xLB8MKWM2B7sPvhi+uPrM5wijYvcO0mp/zlc onESPUEBBv/kLKwR44SAydp/yKwpMYsK7Vtktss10tZi3GsyGgAzG5yrgrvkPFq30se3 cF7iV3TrU+/ezLCDaXZs2Gyua4DPjiSP7Wg20C0WPT/r0lWNtOilS5b3QIpNy5TdjMlz jAGA== 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 i63-20020a639d42000000b003756595d21esi15934845pgd.94.2022.03.02.03.41.58; Wed, 02 Mar 2022 03:42:15 -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 S239705AbiCBG3w (ORCPT + 99 others); Wed, 2 Mar 2022 01:29:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231644AbiCBG3v (ORCPT ); Wed, 2 Mar 2022 01:29:51 -0500 Received: from cstnet.cn (smtp21.cstnet.cn [159.226.251.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F39943DA50; Tue, 1 Mar 2022 22:29:07 -0800 (PST) Received: from localhost.localdomain (unknown [124.16.138.126]) by APP-01 (Coremail) with SMTP id qwCowACHjPCeDh9iXMcDAg--.17642S2; Wed, 02 Mar 2022 14:28:50 +0800 (CST) From: Jiasheng Jiang To: kuninori.morimoto.gx@renesas.com Cc: broonie@kernel.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, f.suligoi@asem.it, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, Jiasheng Jiang Subject: [PATCH v3] ASoC: fsi: Add check for clk_enable Date: Wed, 2 Mar 2022 14:28:44 +0800 Message-Id: <20220302062844.46869-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: qwCowACHjPCeDh9iXMcDAg--.17642S2 X-Coremail-Antispam: 1UD129KBjvdXoW7Xr47tF15uFW3uw4kKFW7Arb_yoWkuFc_Aa 1jg39Iqw15urWfCasrJr4UJ34j9r4UZF1UGryIqF1ftayUJr15ur4UZr9Yvrn0qw1a9as3 A3WDZr4xArW3CjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUb38FF20E14v26ryj6rWUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j 6F4UJwA2z4x0Y4vEx4A2jsIE14v26F4UJVW0owA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jrv_JF1lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2 Y2ka0xkIwI1lc2xSY4AK67AK6r47MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r 1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CE b7AF67AKxVW8ZVWrXwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0x vE2Ix0cI8IcVCY1x0267AKxVWxJVW8Jr1lIxAIcVCF04k26cxKx2IYs7xG6Fyj6rWUJwCI 42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWI evJa73UjIFyTuYvjfUnuWlDUUUU X-Originating-IP: [124.16.138.126] 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,T_SCC_BODY_TEXT_LINE 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 As the potential failure of the clk_enable(), it should be better to check it and return error if fails. Fixes: ab6f6d85210c ("ASoC: fsi: add master clock control functions") Signed-off-by: Jiasheng Jiang --- Changelog: v1 -> v2 * Change 1. Seperate the error handler. v2 -> v3 * Change 1. Revert disable_xck and disable_ick. --- sound/soc/sh/fsi.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index cdf3b7f69ba7..e9a1eb6bdf66 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c @@ -816,14 +816,27 @@ static int fsi_clk_enable(struct device *dev, return ret; } - clk_enable(clock->xck); - clk_enable(clock->ick); - clk_enable(clock->div); + ret = clk_enable(clock->xck); + if (ret) + goto err; + ret = clk_enable(clock->ick); + if (ret) + goto disable_xck; + ret = clk_enable(clock->div); + if (ret) + goto disable_ick; clock->count++; } return ret; + +disable_ick: + clk_disable(clock->ick); +disable_xck: + clk_disable(clock->xck); +err: + return ret; } static int fsi_clk_disable(struct device *dev, -- 2.25.1