From patchwork Fri Aug 16 12:32:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13766060 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 1EA05C52D7D for ; Fri, 16 Aug 2024 12:36:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=M3LNSQjxs6knu07oTqqXD2vtqpOl0khzecMqHctA770=; b=SiNtFe67H3WS4crKBgwq5j11pX mRtqm0kAwBZtWUEH52PPdQlkjdOTLCmKpAiQ+GxYk0yr7yRMlMrUDyLfvp+31QE5dJqKSEOl+TQGQ aQ6BUt78WOXyUO98jMwjIT3lT/NGpATUwAUG8zxHPQt5WdbFN0P0ugI1WBY4LA+Z6Q70FiRavX472 xOk5SbdlYSC642Jp+ArJSoiS3eSqc+LrfT6+g9gIKzinqDVDCZQ4hVW+YhvoJNSQojQMdrWprQBNL YoKp2BEyMXoj0i3obwszRrbANmJbx/q1ReJ18FZr75cwDPnU58UQ1TubvKlIlqw2WwMtBGK3VD9Kv r0uS/C+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sewCA-0000000CtjY-1r3c; Fri, 16 Aug 2024 12:36:42 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sew7r-0000000CsjB-1ReB for linux-arm-kernel@bombadil.infradead.org; Fri, 16 Aug 2024 12:32:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=M3LNSQjxs6knu07oTqqXD2vtqpOl0khzecMqHctA770=; b=JE8E3X0HX8uKAd7yx5/qFGHOdX mTk6dWV27uW+lbbMdd8iSRneKUJlMs0AmXlC/ad8rZ9LvkyRXG9ZIJjDGB+vrRVftlnD//4Uac75D 1g+njBuy1QMGZULw7C7VD94cpsHmSHCfb0kBOe2hyG7PGHtB41iHe8ZjnQnZZ9eo4EA8LwK1C+Ti2 fnshO7WBpUO/CfO8vAVr4qf0wY/5FZiH11t9qevIFdUFolfRcjSwt2jTl9i4oTaNSmC6xUalliewF emgyyEeCdD7AofNbvA9BEsjgsNLJQrWLaTJubdDfaS2ZrLguaqy06JYbfXdC3MREXH1Nd7Xp872eY 6Y97MoLw==; Received: from mail-qv1-xf32.google.com ([2607:f8b0:4864:20::f32]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sew7m-00000008eGq-2DNj for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 12:32:13 +0000 Received: by mail-qv1-xf32.google.com with SMTP id 6a1803df08f44-6bf7ad1ec3aso6789626d6.0 for ; Fri, 16 Aug 2024 05:32:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723811527; x=1724416327; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=M3LNSQjxs6knu07oTqqXD2vtqpOl0khzecMqHctA770=; b=RB3mXAzWStMJvAojlIVaK/I8l7uWB7lfAEB5efGGoRcyF0x3REPD9fFlyaI5siGziW Ja9fbeXvIdICEmwzAFeBICtsKE7SFb94I/A8R4cKM8Z6ZtDeukHTjVm75KFnmfnmp971 rMwR237TxnYC0j6z7QhkE2DpiEHEB3VOdl7MI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723811527; x=1724416327; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M3LNSQjxs6knu07oTqqXD2vtqpOl0khzecMqHctA770=; b=t5rjDIymVHfHR74qqa7LFAa4E96pdgthIcjEd8mP0kXCYtnyQYP14Y4SQV3oisBmpY S0988euubknvwZItyN1GGlMC/8zVjMcsCZ3Ef4PeytML4uVccukspDU4SSJ4tC6sVUsE QXjjQfaHZ1uOhUMLOTX0plONR/2JpywiCzLw+QtvzRTrN7U4+fsDWtKiDMAN3kMJhLjZ epugwjBLP/R+zEHfN0XqOItcFd6y0DEEYt+Bkd6UcGgsWltJBDUy5n9JxcnR6mY8ggiZ Wk3Wu336nMyutE+028IUXuisdy8gcdZY7jrODbhghKLD7bON4EyFciRgyh9tkK64vby2 b7pw== X-Forwarded-Encrypted: i=1; AJvYcCXXHBWqM7IQzkg+vv6N0jztjoFYddmy2v5eTVwDIPjLnE2CJFCoNrJ0LgCuhYpkD2o0TJg+4KKHuJzUsRU2AjagFqrgYdIjx+/fhDnJLZb/rBiH2B4= X-Gm-Message-State: AOJu0YyxjlyJdAXSLRLrMgw5NK2nCPKVWDeQX+h1iJytQDDHhLWvK5f4 Eyti6WfyAKDarozTQ0omAxQAiwVSRWI/1nifmH1lNXQeki2ckYlYgLq9dHDGig== X-Google-Smtp-Source: AGHT+IHYD7aRmKGXgp+t/Ifehq3d65H0DR+M710hdZy/In2eSfy3ZYdXCjNDHAYDxXFnFLaObLyDlQ== X-Received: by 2002:a05:6214:3d9c:b0:6bd:83cb:1b8f with SMTP id 6a1803df08f44-6bf7ce5a411mr36042536d6.36.1723811527255; Fri, 16 Aug 2024 05:32:07 -0700 (PDT) Received: from denia.c.googlers.com (123.178.145.34.bc.googleusercontent.com. [34.145.178.123]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6bf6fef3107sm16881426d6.121.2024.08.16.05.32.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 05:32:06 -0700 (PDT) From: Ricardo Ribalda Date: Fri, 16 Aug 2024 12:32:03 +0000 Subject: [PATCH v2 5/6] media: meson: vdec_1: Refactor vdec_1_stop() MIME-Version: 1.0 Message-Id: <20240816-smatch-clock-v2-5-c63105db07e8@chromium.org> References: <20240816-smatch-clock-v2-0-c63105db07e8@chromium.org> In-Reply-To: <20240816-smatch-clock-v2-0-c63105db07e8@chromium.org> To: Sakari Ailus , =?utf-8?q?Krzysztof_Ha?= =?utf-8?q?=C5=82asa?= , Mauro Carvalho Chehab , Sylwester Nawrocki , Andrzej Hajda , Neil Armstrong , Greg Kroah-Hartman , Kevin Hilman , Jerome Brunet , Martin Blumenstingl Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Ricardo Ribalda X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240816_133211_164897_E31D0439 X-CRM114-Status: GOOD ( 12.58 ) 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 Factor out all the power off logic, except the clk_disable_unprepare(), to a new function __vdec_1_stop(). This allows vdec_1_start() to explicitly clean-out the clock during the error-path. The following smatch warning is fixed: drivers/staging/media/meson/vdec/vdec_1.c:239 vdec_1_start() warn: 'core->vdec_1_clk' from clk_prepare_enable() not released on lines: 239. Signed-off-by: Ricardo Ribalda --- drivers/staging/media/meson/vdec/vdec_1.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/meson/vdec/vdec_1.c b/drivers/staging/media/meson/vdec/vdec_1.c index 3fe2de0c9331..a65cb4959446 100644 --- a/drivers/staging/media/meson/vdec/vdec_1.c +++ b/drivers/staging/media/meson/vdec/vdec_1.c @@ -129,7 +129,7 @@ static u32 vdec_1_vififo_level(struct amvdec_session *sess) return amvdec_read_dos(core, VLD_MEM_VIFIFO_LEVEL); } -static int vdec_1_stop(struct amvdec_session *sess) +static void __vdec_1_stop(struct amvdec_session *sess) { struct amvdec_core *core = sess->core; struct amvdec_codec_ops *codec_ops = sess->fmt_out->codec_ops; @@ -158,10 +158,17 @@ static int vdec_1_stop(struct amvdec_session *sess) regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_SLEEP0, GEN_PWR_VDEC_1, GEN_PWR_VDEC_1); - clk_disable_unprepare(core->vdec_1_clk); - if (sess->priv) codec_ops->stop(sess); +} + +static int vdec_1_stop(struct amvdec_session *sess) +{ + struct amvdec_core *core = sess->core; + + __vdec_1_stop(sess); + + clk_disable_unprepare(core->vdec_1_clk); return 0; } @@ -235,7 +242,8 @@ static int vdec_1_start(struct amvdec_session *sess) return 0; stop: - vdec_1_stop(sess); + __vdec_1_stop(sess); + clk_disable_unprepare(core->vdec_1_clk); return ret; }