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: 13766057 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 C84D6C52D7D for ; Fri, 16 Aug 2024 12:34:58 +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=mnNFu46JmywYP9gLg0BBlkiX4LJAIV8Vvr47+Nzo0m8=; b=jb1nS2/a6JNyyeiqyOeuVqfocx AZJ+OMf76RTe+QwQBvIHmgdnX6CMec0eMRzdlJhJDROqPJ+60zkrvca70xlnAR1dOqbYXh7Por1ep 11b2G8v+1ALloMjlMgshA7/OZqqv+QVQf3OPdnu8q6KDVLNOb5AFD9pkeRUlXNTnRJrNQ/Ms9Yv0O z4wIiqICp6U+3cU7aqNUHkJ/0tcr+ok6vvzYFfkTcNq6sXAZCTpSrnzo04R2vB6w/yoxYf1GLa1Ui GHGTllN/Du4jhD4HGYAh+u0hUuBz+vPwKtBc5yB1AXJKEtZraNBKOTaFqkrxe7+60JAkxJrKv57bq MuIrAKzw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sewAI-0000000CtO3-0kbr; Fri, 16 Aug 2024 12:34:46 +0000 Received: from mail-qv1-f44.google.com ([209.85.219.44]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sew7k-0000000CsfW-3Ubv for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 12:32:11 +0000 Received: by mail-qv1-f44.google.com with SMTP id 6a1803df08f44-6b78c980981so9612486d6.2 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=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=Ug2yfj4YHg+KXUDQOZfNuEQPHWTnG3CYZibJBg6ay7ZJgaZLCOn8M629grU7Ho209h Nyrj8qLZjDk+EdCwUamS7dRLy3N+vcJO59EX+kdO2FiyAGIZcm4qCRnIGXzlb3zRt5co uaHDVI2QZz0u9c7q/YvzvYkN3ILJNVywmuReEdNoCaOxvoozF/J2o4nv1UG4NKEjy5SF U7MEnIWqZ+TUCMBeIYPwqDlEEYbFeP4FgCRqjD2CsoIcEEPk3xLASpmSKPLG616Ye1Gr QDhzmKylQUiWpgLroZYfbhOOigczEZ4E8kMZOZ7M2tOIy2+bsclUTHnjxm9txykGjDSo gkLg== X-Forwarded-Encrypted: i=1; AJvYcCVUZz5lKaz9Z5+Lx83kuQEhu7m5RWV966BQ9LEZSW8BrQps2VXq2kKXyFXJdwu2M20VWWLlCuzXAZ81DV7xn9qTSynnysgIwLy/Xxtgcmu/aQNcBxU= X-Gm-Message-State: AOJu0YxDkp2uXUc2lc3IWf07H0ileGRg7GIspB0q3oR3hEDbVBB+r0hN miimDFt9xi5gELwJbeiLQ8isKrjzNu42K+kp0uJYmfnnWnpN+44Rpc/gBSv1Tg== 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_053209_081609_D2B8761B X-CRM114-Status: GOOD ( 13.29 ) 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 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; }