From patchwork Tue Aug 13 12:13:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13761931 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 84A02C531DC for ; Tue, 13 Aug 2024 12:17:49 +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=ryvSTyFRHLyFB4VqqsDZg/Laqqf7RuuAiNN+vKB3Dic=; b=vItBkqdJdHOF5rzk8hz0lju77p rf46KEpx1iT8wUG+LHrmlDxZbbktXqq5DPJ9a1XfPdSULbV4c8JvKEam898M/G8o+aIQw2TcVvgsu sLPmPlr2wKXR1qh88nry/0UPLd5tK5/K02nDZWegil7FrBh4PB7EloF9hiLwKboqvuRO5zXGW9Zsv Iaz8AtgOCGgQ+61piAIAl+VPvp+4LNqvbDULs29KcEIlunhnazkxROjSBrg3AUryWG2/lwzRwgzDg 5SWE3Vce7ZhBa+V+0FM2ipcFAtKSlhUEbZypwLlS/o5/a11SFWUuBDHLXTVfeE249FuOrseX+s+Ru Da/zFgaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdqT4-00000003fBG-3Ph8; Tue, 13 Aug 2024 12:17:39 +0000 Received: from mail-qk1-x72d.google.com ([2607:f8b0:4864:20::72d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdqPU-00000003e0l-30Vm for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2024 12:13:58 +0000 Received: by mail-qk1-x72d.google.com with SMTP id af79cd13be357-7a3375015f8so377384485a.1 for ; Tue, 13 Aug 2024 05:13:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723551235; x=1724156035; 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=ryvSTyFRHLyFB4VqqsDZg/Laqqf7RuuAiNN+vKB3Dic=; b=gWxc94lIw8HFHLT5PFd6I0+fkYjd1k81Kc9IgQGyscvMLyjts/P4TXgcl639Wmw5fT QpMNZR7UjRtuo/X2YI7lQetEF7J5FacZjMg+nkKy770b+ffX7znSMp3jiu8nZKQ8+A7V +BBJXOsY5oFFEm1oWdY3uXp7+e5/LehwPoJJ4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723551235; x=1724156035; 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=ryvSTyFRHLyFB4VqqsDZg/Laqqf7RuuAiNN+vKB3Dic=; b=unU7qQAo1/v/QA2SgBORALmnKi68EdHa5BXi7S9rZDhY4s/IR1zgWFCYazjDotIv5a QEC6Rpr5B45cV25DqOXThYITApFOiWCGoaOi19O1W+bYj9B37tHeOCkADujEjV6vpJ9N sY1zbSfEd4fUn4dpRSjj9kfjJdm96Ho4IX7wCPVmXHCcmtdK9tQMUx4k4FzGpBDbcGr5 3Jar5d1bMFR6K/HorFQqsboHXyr8VCtmTf2jPcP0998Mfe2TJsjgqHYjYj1kO8bjJTJZ A2+vBnM1xbuUfPe07OL8moRO9KtQhu7lbs0sDBq6uD1m0Q+LbKlZRoBNbyyndxnZSV5I oM/g== X-Forwarded-Encrypted: i=1; AJvYcCXBLlYzvKEbf+AcsxY7ny1TQFQ4UxJ95gStp5t1VAcvCJNM75tSY51wCWJnBrp9DadYu43bfh67/MNQ+hYJFLkyqInDuDMbO6WGB+CZjBTOTb3f3yI= X-Gm-Message-State: AOJu0Yyj8p+r19CJ9BBkeaJVSKQXGGRtOJILY7n9wSBTUqtFODBm5Ksi Pbg3B8Vb7ITqvonh/JwEITZ4o2jGadwmq+W6MICknEK4oijR0WwoDyH9uKSkmg== X-Google-Smtp-Source: AGHT+IEOX25WNCrWUaMxc3lkZuEvbZq3/dMLr0NrYO2cFstfRrmQqZhk/+W2xbcY25YibUai9xTEGw== X-Received: by 2002:a05:620a:31a9:b0:7a1:6062:ed63 with SMTP id af79cd13be357-7a4e15a434dmr379872785a.29.1723551235139; Tue, 13 Aug 2024 05:13:55 -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 af79cd13be357-7a4c7d71ca8sm331765485a.50.2024.08.13.05.13.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 05:13:54 -0700 (PDT) From: Ricardo Ribalda Date: Tue, 13 Aug 2024 12:13:52 +0000 Subject: [PATCH 5/6] media: meson: vdec_1: Refactor vdec_1_stop() MIME-Version: 1.0 Message-Id: <20240813-smatch-clock-v1-5-664c84295b1c@chromium.org> References: <20240813-smatch-clock-v1-0-664c84295b1c@chromium.org> In-Reply-To: <20240813-smatch-clock-v1-0-664c84295b1c@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-20240813_051356_830244_49C92796 X-CRM114-Status: GOOD ( 12.97 ) 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; }