From patchwork Fri Aug 16 12:31:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13766052 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 94FCEC52D7D for ; Fri, 16 Aug 2024 12:32:57 +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:Cc:To:In-Reply-To:References:Message-Id :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=Gf4NWW60XkpB3duPPv/fDMGqfCzxG05NQGwEHcEnJIk=; b=GQpRO2uAoeJQWy DHCIVwpA7mLb4XD1lbTU/KCitutvqHd7PiTPGayHtPANp1otIYlB6p1diY9Aze3kQowLDyGwc5rJ4 teg59h1xllUOyK8ZM9ox6f9yxgujKqotxJDFedkaDnChbYkvLAVfbcUodV2TO22xTz0usc2V4RoMj qUdb9EWxxX7AmO0Sj9o161NcSsqMwFXskLpTTpBJHifsRUziJ7wuKHhGGfTDUAnQBrVntznz4Z4ms jnkNMe3tBYO8LvezwLo9JTC5BcDCN+pfZbD90L5FR2OpveQDS39/afwTLyWKT6Cse6aW5fni+A1ik 6Cxn1+b/j7Gh0k6pWRaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sew8P-0000000Cst4-1yLx; Fri, 16 Aug 2024 12:32:49 +0000 Received: from mail-qv1-xf33.google.com ([2607:f8b0:4864:20::f33]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sew7h-0000000CsdI-38Ug for linux-amlogic@lists.infradead.org; Fri, 16 Aug 2024 12:32:08 +0000 Received: by mail-qv1-xf33.google.com with SMTP id 6a1803df08f44-6bf6beda0c0so11181056d6.1 for ; Fri, 16 Aug 2024 05:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723811523; x=1724416323; 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=16nB20lne5nZUXu6hYGLNV1RBZ9sfyRh8sah/xieHmI=; b=AqGAE+vjf4W//hpT7uLbueQ1s4D3sk8JWlv6tzuWqiPfDG4IrWSyXhe9WTuq26a/2P FGytWH/AvnLUpwD40+q5YEueNaONuTcv4q3J/qbfGS1KiWXfhYV1gxKS9ltAtCBP4lKa Gczm7vRY2GOIX5FY3fYC1gWUqSKm0oAzg7WJk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723811523; x=1724416323; 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=16nB20lne5nZUXu6hYGLNV1RBZ9sfyRh8sah/xieHmI=; b=cD26cEhhwk4ELfDJh3TO3SfD2h/Nl/pw0vebLd2DazEyNk60hfGZ6r1uPGYByOfD2y gFrXg55MGy1QfsupAxhJu5avLazes2jPH0kgUqoVQ/j+4Reard9K1c7dbqis+7OUyJqW ID7T/2dvL4xmXENme0NKJ8q51la/WBbNOovLQi6lLSOE2PN4md/gYKLXo8fTix+/ESb6 isgRKXonqAip/nn6YjFmd9GU1rW11P/LupDqm+H9FXq6fkF0F1wBmfFzppX3BSR7m4oF ukc42H10Ps8/aNxoLt85tZkj3sXMy7B7d3ywiwTKXv/td/ZWpclB6m5cBI1GtDRKhs3i 8Qmg== X-Forwarded-Encrypted: i=1; AJvYcCXU2rCC0ROadtbeKDclEJEu8zagkx6GU8uywSGaheMFV/4WkQsJInXWqOgYAUcxfkPewVVx7c2dX4Dwe5+5W9U2+NPU3KdwD1be6mCOTvc6agI= X-Gm-Message-State: AOJu0YxVH3/bxuM5sNmmZezS3I9gqwuGZLlKqYIOR+zt+s8FpDDm/yNk QWC5MwrnmJobXbNkZYK5VZc6rHM8q63g35lsRMDZsbXFNmc/KG/o/BihajRSPg== X-Google-Smtp-Source: AGHT+IEc/DNqda2J9XQ7o/We+y3QlRxp9UtmD1+ZU6guILT/Q3NfuJJCxXcnUIyCC+eWr3aG9Ceo3Q== X-Received: by 2002:a05:6214:5892:b0:6b4:fde8:8688 with SMTP id 6a1803df08f44-6bf7cebc8d0mr28626046d6.53.1723811523632; Fri, 16 Aug 2024 05:32:03 -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.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 05:32:02 -0700 (PDT) From: Ricardo Ribalda Date: Fri, 16 Aug 2024 12:31:59 +0000 Subject: [PATCH v2 1/6] media: ar0521: Refactor ar0521_power_off() MIME-Version: 1.0 Message-Id: <20240816-smatch-clock-v2-1-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_053205_881920_133397A6 X-CRM114-Status: GOOD ( 12.35 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Factor out all the power off logic, except the clk_disable_unprepare(), to a new function __ar0521_power_off(). This allows ar0521_power_on() to explicitly clean-out the clock during the error-path. The following smatch warning is fixed: drivers/media/i2c/ar0521.c:912 ar0521_power_on() warn: 'sensor->extclk' from clk_prepare_enable() not released on lines: 912. Signed-off-by: Ricardo Ribalda Acked-by: Krzysztof HaƂasa --- drivers/media/i2c/ar0521.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ar0521.c b/drivers/media/i2c/ar0521.c index 09331cf95c62..56a724b4d47e 100644 --- a/drivers/media/i2c/ar0521.c +++ b/drivers/media/i2c/ar0521.c @@ -835,14 +835,12 @@ static const struct initial_reg { be(0x0707)), /* 3F44: couple k factor 2 */ }; -static int ar0521_power_off(struct device *dev) +static void __ar0521_power_off(struct device *dev) { struct v4l2_subdev *sd = dev_get_drvdata(dev); struct ar0521_dev *sensor = to_ar0521_dev(sd); int i; - clk_disable_unprepare(sensor->extclk); - if (sensor->reset_gpio) gpiod_set_value(sensor->reset_gpio, 1); /* assert RESET signal */ @@ -850,6 +848,16 @@ static int ar0521_power_off(struct device *dev) if (sensor->supplies[i]) regulator_disable(sensor->supplies[i]); } +} + +static int ar0521_power_off(struct device *dev) +{ + struct v4l2_subdev *sd = dev_get_drvdata(dev); + struct ar0521_dev *sensor = to_ar0521_dev(sd); + + clk_disable_unprepare(sensor->extclk); + __ar0521_power_off(dev); + return 0; } @@ -908,7 +916,8 @@ static int ar0521_power_on(struct device *dev) return 0; off: - ar0521_power_off(dev); + clk_disable_unprepare(sensor->extclk); + __ar0521_power_off(dev); return ret; } From patchwork Fri Aug 16 12:32:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13766051 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 E3364C3DA4A for ; Fri, 16 Aug 2024 12:32:56 +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:Cc:To:In-Reply-To:References:Message-Id :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=lCRQo0zK/HYQO0WUeU9nXuIHXB0G5XGwgDl4TWClGDs=; b=3pM6TTwMfoUMui GMHOiOGKggbVsrfBWeiZ1BFMtjRvLfBWfHD6b7TF1N3BIKxMMqErk8Ax4OGfy7cf4+UJ4nZVEBEIn Fr/AuWn1N4XeF/9W1CXchf/NOK7VBXWZBYcwf8FIgn/0i5DyJX93MrpQjFf0F0HPiuy09OQT/T9Ru KkSy7+iphg+l5aqJwMUK6/u4uWlnmzCBonLGwka8OEUkMCRsqsUM1wLPRDw/7TaED7iMd3t99zMg8 o7CxypTfu0PHs748tHdOeWnvVKG1XZsOJtMQj+xyQSSqKNv7isfo4512cXJDGUpQXxEcXnFrggOsB 9FRgtq2QqFFTs+Uv66gw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sew8P-0000000Cssm-0RzK; Fri, 16 Aug 2024 12:32:49 +0000 Received: from mail-qv1-xf33.google.com ([2607:f8b0:4864:20::f33]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sew7h-0000000CsdN-37bL for linux-amlogic@lists.infradead.org; Fri, 16 Aug 2024 12:32:08 +0000 Received: by mail-qv1-xf33.google.com with SMTP id 6a1803df08f44-6bf84c3d043so1123566d6.3 for ; Fri, 16 Aug 2024 05:32:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723811525; x=1724416325; 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=rfdvYEITLctEiJZFaHWRY9JyibDLYc0ZAVB9q9sxkkI=; b=Hv2T0JrzNkzPE32xhkCsFlKFqhQnzZfjXSHWR981Si7Lq88fT/0h3QfJzvfIpABRsm g38bc+J4X+ESqm5GFhQxD7JuVieJEmJAMloiKenlbhu7JwsoNjuhQGjjWHI2JbXy9YAU rZA7WkAY8QzS5qTnPsxDpomejy3y2xlocFbHs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723811525; x=1724416325; 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=rfdvYEITLctEiJZFaHWRY9JyibDLYc0ZAVB9q9sxkkI=; b=maMzeEhgNvrDN7n+CVj1psjjAO49F+mSAx4hPd/EbxR5gMrd3qcDbIfO+VzNatBjWx 2Wc2DqokyGMZbKle8eyt/Q7jAWXos3vGdlB8y6yoDNOI9FvJpt25qx6otPZ8i5a/9vUB YO1AxZXGqwZXz5DLITBjCvWBQgs4quLhBWi5YzjV+KADQwXqWJPOe0F5oe8RYKGRqxMY ewxD4Jwz52D+LKOK7XfbVAxcCfI9Ue6JGuHO/lnZTiOqRkIoPTFPWgJk1Iys8MAyNzC9 y3aIralSguG8zcxQK3jB10qDn3QbbFCF8BDDr1FxcraTG21bmvwuNPMphpXaxpLMD2C9 wUHQ== X-Forwarded-Encrypted: i=1; AJvYcCUTAFOagcBYzCFcr8pMW3PtPbUU8Qku0tn410yvu9wdZbpfTZrqBMnoG4Th8Q6CBf9culP40G9Op/IRPEoz@lists.infradead.org X-Gm-Message-State: AOJu0YzgAxGGjwubMyFj3QkgEuApyBnnhZbOVhiOYF8gNCePk2IJt9kM r5+2AnqIb1ZoO+4glXZL8GX67y5ycbObl+wSV+IClsO2BBkupWc3UY3vbxctZw== X-Google-Smtp-Source: AGHT+IEykfMYCYnAHIqKejoI5UsxnxEpAhtpapnpWCBE4rLm0ZmyJu5Jr8Cmioy5du0vYTkAoMT82A== X-Received: by 2002:a05:6214:4520:b0:6b7:ae86:e33e with SMTP id 6a1803df08f44-6bf7ce59f5cmr23889246d6.37.1723811524592; Fri, 16 Aug 2024 05:32:04 -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.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 05:32:04 -0700 (PDT) From: Ricardo Ribalda Date: Fri, 16 Aug 2024 12:32:00 +0000 Subject: [PATCH v2 2/6] media: i2c: ov5645: Refactor ov5645_set_power_off() MIME-Version: 1.0 Message-Id: <20240816-smatch-clock-v2-2-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_053205_862080_BA7AF4EE X-CRM114-Status: GOOD ( 10.81 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Factor out all the power off logic, except clk_disable_unprepare(), to a new function __ov5645_set_power_off(). This allows ov5645_set_power_on() to excplicitly clean-out the clock during the error-path. The following smatch warning is fixed: drivers/media/i2c/ov5645.c:690 ov5645_set_power_on() warn: 'ov5645->xclk' from clk_prepare_enable() not released on lines: 690. Signed-off-by: Ricardo Ribalda --- drivers/media/i2c/ov5645.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c index 6c2d221f6973..0c32bd2940ec 100644 --- a/drivers/media/i2c/ov5645.c +++ b/drivers/media/i2c/ov5645.c @@ -635,7 +635,7 @@ static int ov5645_set_register_array(struct ov5645 *ov5645, return 0; } -static int ov5645_set_power_off(struct device *dev) +static void __ov5645_set_power_off(struct device *dev) { struct v4l2_subdev *sd = dev_get_drvdata(dev); struct ov5645 *ov5645 = to_ov5645(sd); @@ -643,8 +643,16 @@ static int ov5645_set_power_off(struct device *dev) ov5645_write_reg(ov5645, OV5645_IO_MIPI_CTRL00, 0x58); gpiod_set_value_cansleep(ov5645->rst_gpio, 1); gpiod_set_value_cansleep(ov5645->enable_gpio, 0); - clk_disable_unprepare(ov5645->xclk); regulator_bulk_disable(OV5645_NUM_SUPPLIES, ov5645->supplies); +} + +static int ov5645_set_power_off(struct device *dev) +{ + struct v4l2_subdev *sd = dev_get_drvdata(dev); + struct ov5645 *ov5645 = to_ov5645(sd); + + __ov5645_set_power_off(dev); + clk_disable_unprepare(ov5645->xclk); return 0; } @@ -686,7 +694,8 @@ static int ov5645_set_power_on(struct device *dev) return 0; exit: - ov5645_set_power_off(dev); + __ov5645_set_power_off(dev); + clk_disable_unprepare(ov5645->xclk); return ret; } From patchwork Fri Aug 16 12:32:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13766056 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 D6FA8C531DC for ; Fri, 16 Aug 2024 12:36:08 +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:Cc:To:In-Reply-To:References:Message-Id :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=ixfP72uOR4TzUqtUitCI044SJB07A/8QCdjPErV97nY=; b=xjhsl7qYY0JIHl VhlQ5T1jFlXbcWfL93YY41rtGVN2wIS0+r3hOSIe8K4xzm7VH9SpTPVLY2SoKnyFr2PeoQXKub3cJ bf8A+wHpEpt83Ld03qksGMngHPLc9Dlpno3jVHwxEc6jTHqk9/IXEHBITVJsWf1CIc1So8dbHIyOb sEHrWerljvkivAuQ0WQL7mCxRn7t7BmJwPDKvFg70WkL38njp66lhVilzrNw0n7W/wgtFDprA+0AN 78kGYDLQy5BhAnlYYIKrheEkCEX0IOXXGh65gAxtbY6S2D/uwp60XYg5sDeRg0TvQSbKH9FS/d33O NhX1i81Raiz5aiqrTduw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sewBX-0000000Ctb4-0Io2; Fri, 16 Aug 2024 12:36:03 +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 1sew7q-0000000Csj0-1zvp for linux-amlogic@bombadil.infradead.org; Fri, 16 Aug 2024 12:32:14 +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=zTE0ZAwpLEek+mC97zOMxZoDXTrbmisRlZ9024oJ1x4=; b=AjzScYMMp/QcjauXyvjcCJ1hq1 sAdWbN5D4UM+1PhvXN1JMoHZQjMpTtsHT5VsgUMh1kkbWCukg/VeUhKBptIIFZLSTYSQrj69YtJZx cV0EdVpMiT+5vXOEEjMeQKOpTOEliHfs/cGpPPfcFyye3yjxGeoF/AW9xPvOerf42x1O3p34zfwWD yPbaHy2lEW3Xc9kfbih5nxgr2NuKYEukFuye3drYdz3md3181flxAbNcMWmddmsojR1oJv6r9DptG D07caqvL4QwTafJPNp596+kY+uWGdovOtM2F3cfjBUCXIkcgNZqTaemxPX2eSBGbOVvJNIi7HnzjJ CXMuJ4vw==; Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sew7l-00000008eGm-1x2W for linux-amlogic@lists.infradead.org; Fri, 16 Aug 2024 12:32:11 +0000 Received: by mail-ot1-x331.google.com with SMTP id 46e09a7af769-70968db52d0so2059124a34.3 for ; Fri, 16 Aug 2024 05:32:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723811525; x=1724416325; 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=zTE0ZAwpLEek+mC97zOMxZoDXTrbmisRlZ9024oJ1x4=; b=Q+0G3KguCePek+UOGUII+wqaJRg5MAQ4uupAs+nhPvczvPcGYNK2UBY+q0vthSCYBw r469Z5NzAF19o1G3438arb9VXRfOLMk7anXCvd7yLXRSt9hbwqtLuhSOxh83QP1/C4fe RL4eURSWqv01ziuE5J4VDP9VYQIP8GzrD9TuA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723811525; x=1724416325; 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=zTE0ZAwpLEek+mC97zOMxZoDXTrbmisRlZ9024oJ1x4=; b=PKUcNn2fl/0AANRxC3lur505WwtFwW1u+mMv6x2EMUBwHhfhSrdsNu08U3nWzyoknC 3e8DDXZOnkApX666n0wz8JdWsUxunMkCx8mSCC2/V/A0szBBl6lo27POpwJ8+cuonG0P jL/ULT7/lD4LLKEOAUROg8z0KvaNKhZ0gUvKopFA1fh1ycSE68nHq4cV7E/Pb0JcGiPr 0m4DSNhBH2F8UwEp9oMK0s2t//eVQ+PIdQILItX1FVdRz8H5YC/EY3OZYtFEMrcgkTGm 3lKQ+huv2+CvMueVAx3RbJlemG2Y7tu4jt1E0Q11Hi1EDDpWIMy5/7MAHdhtthcQZ8vw KSFA== X-Forwarded-Encrypted: i=1; AJvYcCU7PpGajxVeFRQXdzf75aU4/sTWvtDGZ+qrOWI012dvjDspeumLa35fIx0RKmLqzH/k4Lev49LKf6tQXkej@lists.infradead.org X-Gm-Message-State: AOJu0Yyq1rzcwcREWMXGKIlSrgUvebxfbLTLsq7otJIU10jpS6lANGid 301PJN8T/19fgzlOz115MVADhI5oaAaDx0U3A60x4AOf20lToFA1SG/6m0WwEw== X-Google-Smtp-Source: AGHT+IF/lV0FO6kyi+dWBfhad0hlEJtndvHJ5Sx3xQGXBIEu/XLpM3FeOaUjff8fbn0cH1v4QPeYnA== X-Received: by 2002:a05:6830:3109:b0:709:3462:a4b6 with SMTP id 46e09a7af769-70cac84216fmr2835025a34.9.1723811525644; Fri, 16 Aug 2024 05:32:05 -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.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 05:32:05 -0700 (PDT) From: Ricardo Ribalda Date: Fri, 16 Aug 2024 12:32:01 +0000 Subject: [PATCH v2 3/6] media: i2c: s5c73m3: Move clk_prepare to its own function MIME-Version: 1.0 Message-Id: <20240816-smatch-clock-v2-3-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_133209_934337_CD9F4938 X-CRM114-Status: GOOD ( 11.16 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Smatch is very confused by a clk_prepare_enable() being called in an error-path. Fix this warning by moving the clk_prepare_enable() to its own function. drivers/media/i2c/s5c73m3/s5c73m3-core.c:1425 __s5c73m3_power_off() warn: 'state->clock' from clk_prepare_enable() not released on lines: 1425. Signed-off-by: Ricardo Ribalda --- drivers/media/i2c/s5c73m3/s5c73m3-core.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c b/drivers/media/i2c/s5c73m3/s5c73m3-core.c index e89e888f028e..7716dfe2b8c9 100644 --- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c +++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c @@ -1392,6 +1392,16 @@ static int __s5c73m3_power_on(struct s5c73m3 *state) return ret; } +/* + * This function has been created just to avoid a smatch warning, + * please do not merge into __s5c73m3_power_off() until you have + * confirmed that it does not introduce a new warning. + */ +static void s5c73m3_enable_clk(struct s5c73m3 *state) +{ + clk_prepare_enable(state->clock); +} + static int __s5c73m3_power_off(struct s5c73m3 *state) { int i, ret; @@ -1421,7 +1431,8 @@ static int __s5c73m3_power_off(struct s5c73m3 *state) state->supplies[i].supply, r); } - clk_prepare_enable(state->clock); + s5c73m3_enable_clk(state); + return ret; } From patchwork Fri Aug 16 12:32:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13766054 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 E28EEC52D7D for ; Fri, 16 Aug 2024 12:36:08 +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:Cc:To:In-Reply-To:References:Message-Id :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=DFV2R31lDE512a2ldIRq2SQrBg4Qwbo1BVtKeLeL53U=; b=468HrLyi81IiqH Fssu9DrDYKpimcWF7PS2yV6GqOx9rmoDr9iDgD190OUkBTMEkdcv0BjgZ6MxFLgxqL2sfeLQBbeWc 2ciFE3CXHdQLWeJAqI5ePg5iAcnjYNVrHQIGP9eT9VR0rVLhCp4VGraGZHfIS2Ziv39EGsaph9bNJ Bk3xLA6TTjv0jSiNMnTjk2WaTpInD1RII0+fY7LvMGh+L9wZ930Mbw4Vc+PCMtkTTuQZwKF0R/3/w P3SxgF3+gOf0r4+fWRpFzn7hDBlNaXP/lePkHzqg8yTRKHOYKAvE6S3TFVVux2JOWhtSQo6VWCD6Z chgJAXTIJIPUj7Ly/gCw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sewBX-0000000Ctb9-1s0C; Fri, 16 Aug 2024 12:36:03 +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-0000000CsjA-1TvU for linux-amlogic@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=mnNFu46JmywYP9gLg0BBlkiX4LJAIV8Vvr47+Nzo0m8=; b=pVwf8chEugQgwjbg8GznAP9D/t bHHP8mwA18OfKnTeukAJ6McDmOn8UixkuYkOjn65rv0t34EmChA+QGnrlzEK1jNBnJmFNyQJFGkxR KboH/PZFOiJMNQJS6+F8Def8pyzaZCjOOqotiWYfhQT/IJ4pbIP5+UkHeaXKg/iPWJ7bElCCruQRz GV486UwCQzcPteFBYwa3CVeAkRk3yMeJmypsjhk3Wr+SwS6PAKMMTDmoex5Z8RVPwDDauKjye6ehh vQ6aQ+3H0AYfBD4vBLhcYInk3JvGp2ewx7YeBOhwN6oxjs/FJi8bOiVwexhDaBkFO40oHLhMU/oO1 teCGXKxg==; Received: from mail-qv1-xf34.google.com ([2607:f8b0:4864:20::f34]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sew7m-00000008eGr-2D6u for linux-amlogic@lists.infradead.org; Fri, 16 Aug 2024 12:32:13 +0000 Received: by mail-qv1-xf34.google.com with SMTP id 6a1803df08f44-6bf66fe9d8bso9565516d6.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=mnNFu46JmywYP9gLg0BBlkiX4LJAIV8Vvr47+Nzo0m8=; b=N26n4DgTqQ5pwzh214O2DcF1o5v9x4tG5VCfh2gEY+XJyJnJN/LKIKi3ISEGWGnFnz 6nYG1yD4q+KGNrGYZVCKUeNb6ADBk0kEajnSB/x1Ofe/pcl9AE3OHh8/LzxZyRD2ps9y cXAYvStUOTtsPbix5IF93GjB/bLYsjvbXV2RA= 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=mnNFu46JmywYP9gLg0BBlkiX4LJAIV8Vvr47+Nzo0m8=; b=q+awPAliE9z0+l+CtY9oTN5zGj/4Li1BehHiKuoZ5MlJmkReG0leZUnln1udzRZpqY W2s6QKH9OrSIQcOe6jgh3yQ5auRg0hqauY5clwFLfDRZE0FJyo5l2Iz4ULHUo3HiqLWS CMEw3zPS/QcJW0PcXZg94Mjc+UL1vQ1GACS7DAPkc2jw5orMR3CxW4rJKjR4oKh1UnLc BILloIPcAVAz72Xz2SlyaxGimdGMk+1A/WeX85BjjLEtrMKtb4OsDXDstglBKaU5sawX SuWSPwKhLUA0T3nPAu+JxzLWL4NgO/N21tWJvqFW3c6ceko7MYCS8z2zAVYQ33hRxXaA fx9g== X-Forwarded-Encrypted: i=1; AJvYcCXsk7cvWlS/8jNIm4p3vdMkUiDDSHdJhTzmkjIbO8NYcaJg20Y3AkMpe2tmn3t4jX0xwXzDrHDJ7+0d3WHyMG8HI2akXKNAaqC/Uf6VeHe/yTA= X-Gm-Message-State: AOJu0YwmkncizU6xH8UJrV4FAQvj5F81s5AMUmeVY3rXuqprkzYRfXij yfkuRak4SboMQz2O+L+sHz7qK6DiwIg7lzRAg8wsddeewXPYBdNdCbOU8BQ1Uw== X-Google-Smtp-Source: AGHT+IEXSYQZCNIKPB9LFR6rX4AtZ6JNPVrFndATYre1U0wDC52xZRkYWs1UJ+Wy8jMyb2SytEJSUQ== X-Received: by 2002:a05:6214:a67:b0:6bf:7f5b:1d3 with SMTP id 6a1803df08f44-6bf7f5b0255mr17407566d6.16.1723811526538; Fri, 16 Aug 2024 05:32:06 -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.05 (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:02 +0000 Subject: [PATCH v2 4/6] media: tc358746: Move clk_prepare to its own function MIME-Version: 1.0 Message-Id: <20240816-smatch-clock-v2-4-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_033908_5254BD91 X-CRM114-Status: GOOD ( 11.73 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Smatch is very confused by a clk_prepare_enable() being called in an error-path. Fix this warning by moving the clk_prepare_enable() to its own function. drivers/media/i2c/tc358746.c:1631 tc358746_suspend() warn: 'tc358746->refclk' from clk_prepare_enable() not released on lines: 1631. Signed-off-by: Ricardo Ribalda --- drivers/media/i2c/tc358746.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/tc358746.c b/drivers/media/i2c/tc358746.c index edf79107adc5..389582420ba7 100644 --- a/drivers/media/i2c/tc358746.c +++ b/drivers/media/i2c/tc358746.c @@ -1616,6 +1616,16 @@ static void tc358746_remove(struct i2c_client *client) pm_runtime_dont_use_autosuspend(sd->dev); } +/* + * This function has been created just to avoid a smatch warning, + * please do not merge it into tc358746_suspend until you have + * confirmed that it does not introduce a new warning. + */ +static void tc358746_clk_enable(struct tc358746 *tc358746) +{ + clk_prepare_enable(tc358746->refclk); +} + static int tc358746_suspend(struct device *dev) { struct tc358746 *tc358746 = dev_get_drvdata(dev); @@ -1626,7 +1636,7 @@ static int tc358746_suspend(struct device *dev) err = regulator_bulk_disable(ARRAY_SIZE(tc358746_supplies), tc358746->supplies); if (err) - clk_prepare_enable(tc358746->refclk); + tc358746_clk_enable(tc358746); return err; } 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: 13766055 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 B24C6C3DA4A for ; Fri, 16 Aug 2024 12:36:08 +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:Cc:To:In-Reply-To:References:Message-Id :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=jfXRHgNmVomF9ZOj5rGnL1PNCAiK/HlLYM4UnbqEBXs=; b=Unmk2XDkLnqICB XO7o2t9nGM+vx//NfMJ4SfcvU2sU5lHXs9IwhH4JtTaooDky5/hAj3TbL6olJLttAyQz1w6Lcd6mr IN3AHS3ugkLqUwaZrjgaBKLSnGgrKWaKQLti7zwjZvrs7yKJmV5fX6mJVbRUqXJa9zT7uGvKZWkN+ o3o5GyiL+rMw+ySIGTIqqbjWkwrfH0s10AOLiXC+mTwNzWx+LxbwFNhKuADFfNBQ/DAyTzv3eNK5G hoUib1bCnIOzd1xU201Fg44AqP16otiupFzp+z9iFu5TujEQvyVaCESJrhrw4/2HCJZDHZegxEQtc OExKoZ2k2orq+Zw3YRTg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sewBX-0000000CtbX-3Pwm; Fri, 16 Aug 2024 12:36:03 +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-0000000Csj9-1SST for linux-amlogic@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-xf2d.google.com ([2607:f8b0:4864:20::f2d]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sew7m-00000008eGs-2DHj for linux-amlogic@lists.infradead.org; Fri, 16 Aug 2024 12:32:13 +0000 Received: by mail-qv1-xf2d.google.com with SMTP id 6a1803df08f44-6bf6ea1d34aso10385516d6.1 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=tx55q0zVsltsCUvTw82Dbq/Uy6708yKOM1LgQVm2eP2v9avzzLxrYGu3O0pQSw2GC/ IRu/RFyXQDPK0HI6I7avelA2pq1PWjUpsNh0/x1yyAR6PzFEhv7uPjvBe0Z3nPPNTWb0 6h/lcSYWKqjdUJtndQNhNYDB9pSVwaOJd14cBc3Eyg7xUx8i3l8oCZFSHyHam/JxLJ5d laypM74Hj1RXz5DTg0GSGHjITxlzKksyuY1pAuoL9sZV+J4Ym83wsUBDZWiq9JaOXfkK 9GZeF78hzmdmjabUyJzDGPpkrenoY/ATk64i62hcfSuwBp8ziQ8j4ZosmCWbgp5HD/N1 rOkQ== X-Forwarded-Encrypted: i=1; AJvYcCWclQt/+S9KvTMJZxqTfp7ykAthYAmjKt4l2SRmROcspvUvkl9GK6VqtXsqqzGwj2ew1NXnJNz6xIVbIUh97VrP9i4MeZawlYSojas325/7ccQ= X-Gm-Message-State: AOJu0YwDXaWGE9h4/lZ9aIyHWLDHkv5c8xZ0DrvlKG7E+ywMbMwZyuG7 V43czIDFot3SX6r1MoSs5s9CUR20KVAeJK4zEUQuZ7LQ3a/9hgRNwGvjOWfWvA== 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_200539_B3971FC1 X-CRM114-Status: GOOD ( 11.17 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=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; } From patchwork Fri Aug 16 12:32:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13766053 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 5A6D0C52D7D for ; Fri, 16 Aug 2024 12:34:54 +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:Cc:To:In-Reply-To:References:Message-Id :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=nYylkCD7rT3MCL4Z8VQq5JZc589Br2Sd6MdhGCRsbV8=; b=xdWsN/uBNiJd/U brLTN+eZizTO7xXJ2gsL1QOlcV3RpfZX140VCSbqXAg8x1Wiypbt2VsB27M2zHK+njldkIfKM4uCt FM+oJ+r12eiNGQ2lZO8w3YyxqkFAXsORPFfSW1We22M8O5Max+ots++ePOf9HAdvZ/znWJjEAniGK 9WuwX9xs5CCDR/f0rZ+z0+AYzipjBqV40PF32kFLGzadwwSknYi9p5u6jjs07/5+dpJGspM7gXlVD 5Wrz4hChQ3cBE0WOUI1N+fnM3OFekqwDl6VGV4hTdv9SJqFFyJTW6Su5cnKCIQi95McZs0vaxFNHG IJDt/+ZeoKLu0iUsJ3WQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sewAJ-0000000CtOM-210Q; Fri, 16 Aug 2024 12:34:47 +0000 Received: from mail-qv1-xf2a.google.com ([2607:f8b0:4864:20::f2a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sew7l-0000000CsgF-0kNk for linux-amlogic@lists.infradead.org; Fri, 16 Aug 2024 12:32:11 +0000 Received: by mail-qv1-xf2a.google.com with SMTP id 6a1803df08f44-6bf825d779eso1859036d6.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=1723811528; x=1724416328; 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=yVxZXuTJqaJ10E0yGjjv9nH2alidPK1Y4VYj7sM9de4=; b=FwBLhip8Yu+p2AgovlMOSnKoYxBZjV0DDmHC/JSvQF/ftyg23URYqZ6DEAM3TVJMYh +Nbxkbwh2Mt5yDhoFYYqZwJ6BUQqReD0F83bY4tgUc98TLjOJ4Rm15y1j6p5beeQU3ak FYwu2in/wG1Ebipsf83VtdaQ9GERqBpE1EMLU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723811528; x=1724416328; 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=yVxZXuTJqaJ10E0yGjjv9nH2alidPK1Y4VYj7sM9de4=; b=hyJBtiQid+d5ojgc2hgFUTiLZK/wq7zmT4+jXrao5jSgxx7J1YUcCAFavS/GV03zl4 0ssAi99tCcL5vfq8tfElGGUdetis3bpxhfMR7L8wxGtxC2bULO0ncKw09xfir0D6Ce84 RHw66DZhVW4Fl2qE13gpIzAkYOfybbAuLZ/GTI8BNHqskvenB3UBBZPIy9d0GWxP1kzw e8NJ4Ue2nGHWpPxVGEz9mNFsRokDT5ZuED4DTKz8vv/DZTG/ilzW9NGwsI3tGl44Ib2k 7Ix/znA6mGxVzxDtOOc3AQ5t+7iVkXS1vKWyyDsZAbmBlEy7FMCcq+H6lXyvz9uZlnjL /lvA== X-Forwarded-Encrypted: i=1; AJvYcCULCn0/UKLWg6eBZNBsaU4n5Fa+85IT02VSPRdW8auxRlD1BSuLgm2i9TLa3ghHn7HznzJsWq9dv/CgzotLOjqGD1F503PqJVIZoMKsqmMHBHs= X-Gm-Message-State: AOJu0Yxd0CYqYKG0beqr5K1orr/A5b8t+/x5+lSdFXfjcLYFtGhCgG2K 5zkzUmH6q/JghN4TLmJsmk/6k0GzGRGQ2a8yqAG3jFzMxAj429FPiwgBkEx6iQ== X-Google-Smtp-Source: AGHT+IHxo1lFSQMX1cM/4MwpLU2TEtbVsyk63XfQG/g27+OnQuVnbh1zDXFyHf9x2ZFHVGoE5m/EQQ== X-Received: by 2002:a05:6214:540a:b0:6bf:700f:a3b7 with SMTP id 6a1803df08f44-6bf7cd7ac78mr23067056d6.9.1723811528290; Fri, 16 Aug 2024 05:32:08 -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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 05:32:07 -0700 (PDT) From: Ricardo Ribalda Date: Fri, 16 Aug 2024 12:32:04 +0000 Subject: [PATCH v2 6/6] media: meson: vdec: hevc: Refactor vdec_hevc_start and vdec_hevc_stop MIME-Version: 1.0 Message-Id: <20240816-smatch-clock-v2-6-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_053209_338332_027E4358 X-CRM114-Status: GOOD ( 13.76 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Make a new function __vdec_hevc_start(), that does all the initialization, except the clock initialization for G12A and SM1. Factor out all the stop logic, except the clk_disable_unprepare(), to a new function __vdec_hevc_stop. This allows vdec_hevc_start() to explicitly celan-out the clock during the error-path. The following smatch warnings are fixed: drivers/staging/media/meson/vdec/vdec_hevc.c:227 vdec_hevc_start() warn: 'core->vdec_hevc_clk' from clk_prepare_enable() not released on lines: 227. drivers/staging/media/meson/vdec/vdec_hevc.c:227 vdec_hevc_start() warn: 'core->vdec_hevcf_clk' from clk_prepare_enable() not released on lines: 227. Signed-off-by: Ricardo Ribalda --- drivers/staging/media/meson/vdec/vdec_hevc.c | 43 +++++++++++++++++++++------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/drivers/staging/media/meson/vdec/vdec_hevc.c b/drivers/staging/media/meson/vdec/vdec_hevc.c index afced435c907..1939c47def58 100644 --- a/drivers/staging/media/meson/vdec/vdec_hevc.c +++ b/drivers/staging/media/meson/vdec/vdec_hevc.c @@ -110,7 +110,7 @@ static u32 vdec_hevc_vififo_level(struct amvdec_session *sess) return readl_relaxed(sess->core->dos_base + HEVC_STREAM_LEVEL); } -static int vdec_hevc_stop(struct amvdec_session *sess) +static void __vdec_hevc_stop(struct amvdec_session *sess) { struct amvdec_core *core = sess->core; struct amvdec_codec_ops *codec_ops = sess->fmt_out->codec_ops; @@ -142,6 +142,13 @@ static int vdec_hevc_stop(struct amvdec_session *sess) else regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_SLEEP0, GEN_PWR_VDEC_HEVC, GEN_PWR_VDEC_HEVC); +} + +static int vdec_hevc_stop(struct amvdec_session *sess) +{ + struct amvdec_core *core = sess->core; + + __vdec_hevc_stop(sess); clk_disable_unprepare(core->vdec_hevc_clk); if (core->platform->revision == VDEC_REVISION_G12A || @@ -151,20 +158,12 @@ static int vdec_hevc_stop(struct amvdec_session *sess) return 0; } -static int vdec_hevc_start(struct amvdec_session *sess) +static int __vdec_hevc_start(struct amvdec_session *sess) { int ret; struct amvdec_core *core = sess->core; struct amvdec_codec_ops *codec_ops = sess->fmt_out->codec_ops; - if (core->platform->revision == VDEC_REVISION_G12A || - core->platform->revision == VDEC_REVISION_SM1) { - clk_set_rate(core->vdec_hevcf_clk, 666666666); - ret = clk_prepare_enable(core->vdec_hevcf_clk); - if (ret) - return ret; - } - clk_set_rate(core->vdec_hevc_clk, 666666666); ret = clk_prepare_enable(core->vdec_hevc_clk); if (ret) { @@ -223,10 +222,32 @@ static int vdec_hevc_start(struct amvdec_session *sess) return 0; stop: - vdec_hevc_stop(sess); + __vdec_hevc_stop(sess); + clk_disable_unprepare(core->vdec_hevc_clk); return ret; } +static int vdec_hevc_start(struct amvdec_session *sess) +{ + struct amvdec_core *core = sess->core; + int ret; + + if (core->platform->revision == VDEC_REVISION_G12A || + core->platform->revision == VDEC_REVISION_SM1) { + clk_set_rate(core->vdec_hevcf_clk, 666666666); + ret = clk_prepare_enable(core->vdec_hevcf_clk); + if (ret) + return ret; + + ret = __vdec_hevc_start(sess); + if (ret) + clk_disable_unprepare(core->vdec_hevcf_clk); + return ret; + } + + return __vdec_hevc_start(sess); +} + struct amvdec_ops vdec_hevc_ops = { .start = vdec_hevc_start, .stop = vdec_hevc_stop,