From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D1DFEEB64DC for ; Tue, 11 Jul 2023 20:31:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=XlIhmgNVoZgZJc+j08nJwIkf8hnBnXBDVmij6CyLN4w=; b=c8quYgMo/98z89EOAUxh4f4fZ1 ZWMI6ncRivPx+TrZH3cDgeEqmtkOkF3V7rN7rpfyQAnxDBrRLTd6aeLxNic1kY1DZUC9qzrQD4sGo B+7xsJv0fOpG5TtrXcI9cj/wf82de55QlmBFdPt7Xt5JkvMeai7BzH2ZwCRAv7RxC4yL/e7WYnlVr v5Aim8calyDeTKvXFKlZ6a+N39MMZehw2lV7+eG+nl1H9p9Fi6CDt1zbt1qDqqYKesJIHpBUBJ0VD ZX+E9a9YnM567dD0F03jcAIi/E3vZl97bU3WggAvz7Rn0kdcrDucdo0FKRT5aBIHu6oBVkBNFu37H l1qR/wEQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qJK0J-00FqTz-1Z; Tue, 11 Jul 2023 20:30:35 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qJK0G-00FqSt-10 for linux-arm-kernel@lists.infradead.org; Tue, 11 Jul 2023 20:30:34 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qJK03-0002td-Rm; Tue, 11 Jul 2023 22:30:19 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1qJK02-00DjLv-Qr; Tue, 11 Jul 2023 22:30:18 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qJK02-0048Gc-1l; Tue, 11 Jul 2023 22:30:18 +0200 Date: Tue, 11 Jul 2023 22:30:17 +0200 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Guiting Shen Subject: Re: [PATCH v3] pwm: atmel: Enable clk when pwm already enabled in bootloader Message-ID: <20230711203017.cdfe2nrjx7lt25tm@pengutronix.de> References: <20230711200905.6464-1-aarongt.shen@gmail.com> MIME-Version: 1.0 In-Reply-To: <20230711200905.6464-1-aarongt.shen@gmail.com> X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230711_133032_346469_9ACF538C X-CRM114-Status: GOOD ( 16.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, alexandre.belloni@bootlin.com, linux-kernel@vger.kernel.org, thierry.reding@gmail.com, claudiu.beznea@microchip.com, linux-arm-kernel@lists.infradead.org Content-Type: multipart/mixed; boundary="===============1277930679647343937==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============1277930679647343937== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="6nr4yzoa4725uv5d" Content-Disposition: inline --6nr4yzoa4725uv5d Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, On Wed, Jul 12, 2023 at 04:09:05AM +0800, Guiting Shen wrote: > +static int atmel_pwm_enable_clk_if_on(struct atmel_pwm_chip *atmel_pwm) > +{ > + unsigned int i; > + int err; > + u32 sr; > + > + sr =3D atmel_pwm_readl(atmel_pwm, PWM_SR); > + if (!sr) > + return 0; > + > + for (i =3D 0; i < atmel_pwm->chip.npwm; i++) { > + if (!(sr & (1 << i))) > + continue; > + > + err =3D clk_enable(atmel_pwm->clk); > + if (err) { > + dev_err(atmel_pwm->chip.dev, > + "failed to enable clock: %pe\n", ERR_PTR(err)); Here you leak possibly a few enables. While it's not likely that the (say) third enable goes wrong, it's also not that hard to handle?! Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --6nr4yzoa4725uv5d Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmStu9gACgkQj4D7WH0S /k5IAAf/WJCmZ2JlQoyLBuFHPMvT2efkik3JJQWbRGTjdYi/JPgG77RRVGlhtDyN acKyLmayDKCL9MHg15iRhsh7Us6DWRK3CVadsXtK+sz29fT0j7W20v3QC4oyL3TM 8z/egwginBculUG6gDYrE+q9YJ4CDHfXjSzhvV3y5zV9IHbWasNikd3UlNDRdbAj Smfbmj6Hb4MBAp2YAbkXBHvDa5KgvjxwoqEq9yZs7DD7RNeDsys8VFsnhP0uRlcQ t/RYBW0/py3rpEtFvAFQwXdb98MdyXhDOQJyxac4D2WV9vHAVTLicdh6OAER81/A 1E3SfVrdKwiYaJ5H5+Vaew2hPLmDdA== =ZOFM -----END PGP SIGNATURE----- --6nr4yzoa4725uv5d-- --===============1277930679647343937== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============1277930679647343937==--