Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp300635pxm; Wed, 2 Mar 2022 15:50:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJxtPsPEUW+994D3nDZ9IHVGIOpch1pFDo7uWXd983EZkQedFe3BPGPqbrCXYAcKjiApBOEn X-Received: by 2002:a63:7f52:0:b0:378:cdb3:d068 with SMTP id p18-20020a637f52000000b00378cdb3d068mr11855377pgn.148.1646265036303; Wed, 02 Mar 2022 15:50:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646265036; cv=none; d=google.com; s=arc-20160816; b=vDQl9lKyEFWFruyFljRkZqUHg6u9yiybvs93hUBcCqThx1e8ySYBWzY/lR8CfEE3ij DYZkqFU5T2WYiB3NjG8Y59U40NVNHj9swIMo7rzwQIMpOcOGKljIorNgkJYUH6789xfq zgeIlW0lmtFLXqan37Mm9eiFg6lT6iVdFCv53U73D1FXhrCiakIuv152NZvmck6ihx0F 43/NzB+qVu28GtGWeqfJwE5LMJzgdJi/zGZzICqha67/BMW6hntj+LBwPHsDlnX87gjf ece14Fb1/h2u//YVRyCIGU03XzdS95uEp56NtB7rBzOrf50whnmMTdCz8qNPfFa2joJ0 buig== 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=YXow4JrlJQOeHRWOVi43n2H8AZlq5pwKuC1Isd1GbQA=; b=lo+l91oKE1Q7KBM08+qQ58sWyDJgL2mFtM3boLes7qw3hwc6xZGEygOOOgjCV8q716 hyyjAVQQ+N3fEt0GcrMt3TTaaNglRvYBPxxB1Up6gZSdrokd3tDw3vrDcNsYHSSiXX0x 88KznKxF63KJfCsvcvoKFh3o7t9z/3u1eVr2yX/jEZnGQbY66UqnIlQbrlOQvvzuqVzI KC0EjzwtI/hCDZOAfzgBLCC2BO6vD7cRt2ukSTYZqSvD31wGeE2DT+XyOldq7OwCmtvR ag+TOyshrDt4QukfqX1EGlKP9mK3GPUWdR0dD3Hbk6xfnRaXtxyY898jNAoQcieXhcdA INAg== 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:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e22-20020a63db16000000b00378473f69d7si431492pgg.428.2022.03.02.15.50.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 15:50:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 736D749F88; Wed, 2 Mar 2022 15:12:47 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239265AbiCBDKQ (ORCPT + 99 others); Tue, 1 Mar 2022 22:10:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239260AbiCBDKN (ORCPT ); Tue, 1 Mar 2022 22:10:13 -0500 Received: from cstnet.cn (smtp23.cstnet.cn [159.226.251.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 77A3AAF1CD; Tue, 1 Mar 2022 19:09:29 -0800 (PST) Received: from localhost.localdomain (unknown [124.16.138.126]) by APP-03 (Coremail) with SMTP id rQCowACXnsLO3x5iwKaQAQ--.25965S2; Wed, 02 Mar 2022 11:09:03 +0800 (CST) From: Jiasheng Jiang To: broonie@kernel.org Cc: 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, kuninori.morimoto.gx@renesas.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, Jiasheng Jiang Subject: [PATCH v2] ASoC: fsi: Add check for clk_enable Date: Wed, 2 Mar 2022 11:09:00 +0800 Message-Id: <20220302030900.46341-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: rQCowACXnsLO3x5iwKaQAQ--.25965S2 X-Coremail-Antispam: 1UD129KBjvdXoW7Xr47tF15uFW3uw4kKFW7Arb_yoWkXwb_Aa 1jg39Iq3W5urWfCasrJr4UA34j9r47Za4UGryIq3Z3tayUJrs8ur48Z3sYvrn0qw1Y9as3 Aa1DZr4xArW3CjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbxAFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr0_ Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AKxVWxJr 0_GcWle2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2 Y2ka0xkIwI1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4 xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r4a6rW5 MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I 0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2jsIE14v2 6r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0J UQvtAUUUUU= X-Originating-IP: [124.16.138.126] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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. --- 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..91050478844a 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_xck: + clk_disable(clock->xck); +disable_ick: + clk_disable(clock->ick); +err: + return ret; } static int fsi_clk_disable(struct device *dev, -- 2.25.1