Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp37391070rwd; Tue, 11 Jul 2023 13:39:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlGlsoj1Nukq5p+y9MA5kwSkHBpsLBPxd5sySFNS7+VNyRJfipXsRnY9iGJpyBvHznCOOzth X-Received: by 2002:a17:90a:4414:b0:262:f8eb:ea5 with SMTP id s20-20020a17090a441400b00262f8eb0ea5mr11845168pjg.22.1689107977794; Tue, 11 Jul 2023 13:39:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689107977; cv=none; d=google.com; s=arc-20160816; b=0TD2kyHmtSx2D2P5cS/WeO77+Juinb837W7V+VM/+K+tOSDpp0GT62d4NJpZudoSue 4Hk2k+HoG+CpqfGCdDnOAUh3rlwnC7DJNB/ZyrTbPMhAtI3nztUETPzRCLwPjLxocEB4 OHR6BwJmXE0xvaorsutVjaLy4zwrkFHm/F31HQpi+cRToUW+Aa6oCaK8rcWCinLOvnl2 WQcg9lFmt/kUqm//H+bFadUgh9hb0V/0ncNFISp0wK18Ed3AvP1h+TDm/5MkOz31VCNa kW+bv3S0GNKYfK8nZ6A/F0da/95HYX9osGVmVJmdTI4gvfAde99lFCAPQ3+ObeYLFKGH 3HUA== 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; bh=t5NrxbOHXhJZuY+Ebzg238BEje+e5jYXAErbbo0LmVU=; fh=C0VJkIgHmLDRXp/b0PKU1B4y+R+fq/m08L4inOjGt10=; b=tZ+2xrtRp+pS4zwqxOv8brihNVHYkVlO8P5DP/Q1Wh0o3pdTJPnPkQr4zIVHWd5ghr L3lwnbjrxdPWtkW77ZJjoKAMvlcnA57OG+VKbXKepaEh9WnAKsamhmOSD9zVO1XAQ3eG 7WjxBQu+2eKVss+YQ9dPO5IEZy9VRAD7G2Cv39jPszGHb7YGCYPur6GAK1KKOA48NjXA WrHSmOmNR4JdLhis8vbpm5vJo0WyG0xeXPIXsrxKisXak03XMCKaVDlaZdAQluVH4oZM pW83xy0ivg9NaylQd/DoMOji0uS7l/wvKGCmeiRlsfwVidogspyWB//dMXfHKCUIQ2OH o9YA== 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 d4-20020a17090ab30400b00263e4949dbbsi2141973pjr.29.2023.07.11.13.39.24; Tue, 11 Jul 2023 13:39:37 -0700 (PDT) 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 S229468AbjGKUad (ORCPT + 99 others); Tue, 11 Jul 2023 16:30:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230295AbjGKUab (ORCPT ); Tue, 11 Jul 2023 16:30:31 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A30AE10C7 for ; Tue, 11 Jul 2023 13:30:30 -0700 (PDT) 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 Cc: claudiu.beznea@microchip.com, thierry.reding@gmail.com, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org 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 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="6nr4yzoa4725uv5d" Content-Disposition: inline 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-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 --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--