Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3829764pxm; Tue, 1 Mar 2022 06:17:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJxbfPoml9f+ORGqhb5AsBotabyaDLOofqFfLLEXrYtK1yyM3iQEL0q3IFft3409dT8nS/W1 X-Received: by 2002:a05:6402:3452:b0:415:9d25:3967 with SMTP id l18-20020a056402345200b004159d253967mr1632390edc.125.1646144232332; Tue, 01 Mar 2022 06:17:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646144232; cv=none; d=google.com; s=arc-20160816; b=Ani9Jlyepp8Meg0Mp6/dhIn9d3ExuHNxN1uJbShYj8SW/KU9eH14FBX+cJomhAotxG y8E0xBSAGrg42dvCXRl9wCaLsrJOP5+I/O1AV/Oz0ZLHdlwu8Z3vXYLQfxm1/DO/hLu8 6AeIcXvl0Vc0twv2Ib6VENkzIAiXyw2MisMlxWIEM1dpLwfr4n1z7kxXKeueAug0DxyL TGJxai34jJyQIbdEf4T4hNAk6eMBrRONhEr8WjQDMb1HbqVG8qq6wiAcH1ozki1BRfYy TiIuiTqes6MKhBZZP2uBOsXHd7LfgQx47D3j7RC3z5ArTqe6xetjxXftgsONPtdQ55bS O+nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=wYRqVUNSCEuXeBN59uiY3BIQt5Q6TdROLs8Jd+5Wk/0=; b=d0Iqon4N7yXiml9PgJYCvRP/kpzSiGkWtZRvbZed2JmvxCRhzep5kRLZE2pbWy5Iea g7sfb9Gj6ZOTiiyrI7gHare8e+7p9DJ0uBHjdoss1czEx+S60wC+cF/EDN7NfDnHK7na aL2/OE3w3T8QZJEzG53cjp0chRI/LcOAWlRwE/u5nbEC28QR/z3tsqKCj54jBBaevN1O U85ePtBUhN9035i9hyxTMrKGRmAiQs3E0iyNCozmOfVO9MQoH7rgw/j65dYTR9p5hUfk S5hnoBH1sT0lAU8EBOwlsVxOfR+1IGRxltTsiC/ntjy7gYbN+5a762+1/uS5GWxAk72o +xdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cvEy4Cel; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ci4-20020a170906c34400b006cfcff2e236si7636678ejb.471.2022.03.01.06.16.48; Tue, 01 Mar 2022 06:17:12 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cvEy4Cel; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234829AbiCAMpE (ORCPT + 99 others); Tue, 1 Mar 2022 07:45:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232420AbiCAMpD (ORCPT ); Tue, 1 Mar 2022 07:45:03 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CE5D5DE47; Tue, 1 Mar 2022 04:44:22 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 18A98B818D6; Tue, 1 Mar 2022 12:44:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D6ADC340EE; Tue, 1 Mar 2022 12:44:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646138659; bh=Dvmj37OjCzYRSD5lH+68CdPQAV0uvqJN0PHM1p+T0So=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cvEy4Celqtz56G+ZmoQDluWwekayBnfTCkFgpjXIFUH67plCHqLaSs3bbB243KlIR c45wYDECEVf4LWJ00ZQiKAcyUSHL64BhIGFvma252WcK0UALkdGdrYGD/dqovDJKtR nXEk3Ag/hwkYm5li4hxxk+HMio8KgibuwB4aX5v1Z2zZmHKVjrxL7cIQKNI/tiMITd NkO+5zDQZmAzNeWpLD6uKGpNz/FoYh51Uy8J52cCMjZhmPH1IJKDOsrwcP7vK2YjZm nonLZCYTS9eYAKYZRMI8CD96NDXVzp27Rt1yTEqCpDc6ETJVDQByLrDXXZXW/TIYGE LR+shwwVPEBnw== Date: Tue, 1 Mar 2022 12:44:12 +0000 From: Mark Brown To: Jiasheng Jiang 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 Subject: Re: [PATCH] ASoC: fsi: Add check for clk_enable Message-ID: References: <20220301073949.3678707-1-jiasheng@iscas.ac.cn> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="a4D1fYTki8ZRdcZe" Content-Disposition: inline In-Reply-To: <20220301073949.3678707-1-jiasheng@iscas.ac.cn> X-Cookie: You have a message from the operator. X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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 --a4D1fYTki8ZRdcZe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 01, 2022 at 03:39:49PM +0800, Jiasheng Jiang wrote: > As the potential failure of the clk_enable(), > it should be better to check it and return error > if fails. > - clk_enable(clock->xck); > - clk_enable(clock->ick); > - clk_enable(clock->div); > + ret =3D clk_enable(clock->xck); > + if (ret) > + goto err; > + ret =3D clk_enable(clock->ick); > + if (ret) > + goto err; > + ret =3D clk_enable(clock->div); > + if (ret) > + goto err; > =20 > clock->count++; > } > =20 > return ret; > + > +err: > + clk_disable(clock->xck); > + clk_disable(clock->ick); > + clk_disable(clock->div); You need separate labels for each enable so that we don't end up disabling clocks we didn't enable, that would also be a bug. --a4D1fYTki8ZRdcZe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmIeFRwACgkQJNaLcl1U h9DwBgf/bin2luVJoiauARSYcwKh6nAuT6t1+pRx4vZsv96asJBq6mHzg3Lde11Y m2QgosA3PwMCLdvAIk4gZc2OQfzLQ6r96lgNEFHE3fmZknc9qPeO5P8275sdgfRy xn7l5w0j4y/4QoGu6YpE9EidGOGlkLQMcMvVc3CcpIUQLexWdGIgYUoJDT8MaIrA NNlrI3R296GI6oToypsEEC+KnTcddRKhEqd/wlCTD75OP9WmbQdUkw84mXq4A29F yDHw4BIYC8Mhx+RvUUXSaBue6Ow0kk58x9hdeFIE7Zc2qRk8xuSTxnju+QXIPNZK djNrcWAUdWEufFhsSf26mOnIq6bsrQ== =LFkr -----END PGP SIGNATURE----- --a4D1fYTki8ZRdcZe--