From patchwork Tue Aug 22 07:04:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hari Prasath Gujulan Elango X-Patchwork-Id: 13360251 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 9E177EE49A8 for ; Tue, 22 Aug 2023 07:05:43 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=lzlSaHLCVsUzI1TqpVe09vTNGwDJ8BMJeHfn5N/1yfY=; b=QCHVr4SSfUUGus Q7lxG8xJimNafRESY7I1tegC0tLrEA3qanVOWK4OssmDOu6n8L6k0tQtX+sJQLLZfVpqGlxKtqpIu G7Jm8K8FdpHiwAUkMe8KiFyoiGl7ILAisf90QOq8esPmeWtugiRiXmDRnZ0F6VRboCToq2ppy4wFP rjsScs/sumpwoy2Ny8OYUNr6B2ESKG8CVnJvhYXGCweQRW0em4sERULL0QXyK5YJSBBJS2ZHs/3I1 ksH+Wf6VB7J/aNbJ9b7P1xZ3DhpZOz9aPU8mtjr60vep9RfVeWZs+/h4AKN6k6xBUtHX/qXsrmanm 79e++3OT5pY/zsnEkhLw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qYLRt-00FHI0-32; Tue, 22 Aug 2023 07:05:09 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qYLRq-00FHGb-0W for linux-arm-kernel@lists.infradead.org; Tue, 22 Aug 2023 07:05:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1692687906; x=1724223906; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=mbSEUKxzfd+NdbCyXSlyZygqZr+zo6Ad1ijqItVCU3c=; b=SBmMvv1KowWJhxxyhp/H5IEq+9XWmhQx/Pumw1MfjIiFNOqGmimy/9c3 qyDe5nDkOQYiY7WjIvZKfjU/wWpoa6Qhj1Bv1yFQ6DFL33rwC7rZM50vv UvR4Ce8SJJGkNM+bPILSo+TbNH5DgLQwz4PYqAPfvS6yDx87Xkz9i0jMA clq44e+lBLYHm0u6kHGOVQHSeb/Vn2cnoFSGM8h0n1Uso6g+hyHmVcHkQ yQJ9pMAN/irIq92h0NhcnaB+0QqO0q8EK05ncj6Lcjvfq78srZtN5iUAe SyoX847Qffkp8Yy127Wnh3P1uI2QlB4NcrA0c+ijfM43mPdvOv50NatyB Q==; X-IronPort-AV: E=Sophos;i="6.01,192,1684825200"; d="scan'208";a="608536" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 22 Aug 2023 00:04:58 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 22 Aug 2023 00:04:54 -0700 Received: from che-lt-i63539.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 22 Aug 2023 00:04:50 -0700 From: Hari Prasath Gujulan Elango To: , , , , CC: , , , Hari Prasath Gujulan Elango Subject: [PATCH] pwm: atmel: add missing clk_disable_unprepare() Date: Tue, 22 Aug 2023 12:34:41 +0530 Message-ID: <20230822070441.22170-1-Hari.PrasathGE@microchip.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230822_000506_465843_83287B14 X-CRM114-Status: UNSURE ( 9.55 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Fix the below smatch warning: drivers/pwm/pwm-atmel-hlcdc.c:167 atmel_hlcdc_pwm_apply() warn: 'new_clk' from clk_prepare_enable() not released on lines: 112,137,142,149. Signed-off-by: Hari Prasath Gujulan Elango --- drivers/pwm/pwm-atmel-hlcdc.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/pwm/pwm-atmel-hlcdc.c b/drivers/pwm/pwm-atmel-hlcdc.c index 96a709a9d49a..ce46f6c74a14 100644 --- a/drivers/pwm/pwm-atmel-hlcdc.c +++ b/drivers/pwm/pwm-atmel-hlcdc.c @@ -108,8 +108,10 @@ static int atmel_hlcdc_pwm_apply(struct pwm_chip *c, struct pwm_device *pwm, ATMEL_HLCDC_CFG(0), ATMEL_HLCDC_CLKPWMSEL, gencfg); - if (ret) + if (ret) { + clk_disable_unprepare(new_clk); return ret; + } } do_div(pwmcval, state->period); @@ -133,20 +135,27 @@ static int atmel_hlcdc_pwm_apply(struct pwm_chip *c, struct pwm_device *pwm, ATMEL_HLCDC_PWMPS_MASK | ATMEL_HLCDC_PWMPOL, pwmcfg); - if (ret) + if (ret) { + clk_disable_unprepare(new_clk); return ret; + } ret = regmap_write(hlcdc->regmap, ATMEL_HLCDC_EN, ATMEL_HLCDC_PWM); - if (ret) + if (ret) { + clk_disable_unprepare(new_clk); return ret; + } ret = regmap_read_poll_timeout(hlcdc->regmap, ATMEL_HLCDC_SR, status, status & ATMEL_HLCDC_PWM, 10, 0); - if (ret) + if (ret) { + clk_disable_unprepare(new_clk); return ret; + } + } else { ret = regmap_write(hlcdc->regmap, ATMEL_HLCDC_DIS, ATMEL_HLCDC_PWM);