From patchwork Tue Aug 13 12:13:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13761930 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 DC815C52D7B for ; Tue, 13 Aug 2024 12:17:14 +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=9Etl9GyPmdRz22pfGaoR8C42DApQqo8svGDO8wQI1tI=; b=xwfwd6awsN+18MhHRFI3AiuLSn Mows805f+IBWEkBZ/qepR0YoS6mGx9VXMI9632s59SiqPk/K75MuxSMrCqStapU5PLmRmC9r7DN/x OyAodxZpHpT3IJhwKi6V+dq/mSHuVsfc9f0KnmAb1kFdy4t7yZM4OMiJE12NDo5vkTJjTiDgYlkA0 l+81ecsLL3Idldpwl/MBPouXUkBeh98AOkmZXR5VYDkF/opSM9/4WmLJN710QE1SQC9JAErNEBegP 3Y/E/Nb1U5H1DHs6dTcgpRM7I6IUpC0dn/O6+wipO5Hl0tTWUq6CpjDSw9Y6hKZD9v5pGtF6sJmbx m49oHrRg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdqSU-00000003f4B-3Un1; Tue, 13 Aug 2024 12:17:02 +0000 Received: from mail-qk1-x736.google.com ([2607:f8b0:4864:20::736]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdqPT-00000003dzo-2t7h for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2024 12:13:57 +0000 Received: by mail-qk1-x736.google.com with SMTP id af79cd13be357-7a4df9dc885so86958685a.0 for ; Tue, 13 Aug 2024 05:13:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723551234; x=1724156034; 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=9Etl9GyPmdRz22pfGaoR8C42DApQqo8svGDO8wQI1tI=; b=atdzlX0faKPxcp23lQW0fu/hpr/18j3+HddgmT0i8uRg2D2K+FphZ8L4+/ke2mIFlH lb3QHEcAqIe6q2C659jnSQh1o6qVHWcipNNpDG8GBDfo/o+A7vOJG3dnj/qDq3pUjhWF ag2AhEiBHGn3+kWMWrdLgcdhHfKHh+3bk5JZs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723551234; x=1724156034; 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=9Etl9GyPmdRz22pfGaoR8C42DApQqo8svGDO8wQI1tI=; b=ZSY1ZzIThHRHOzKhrv876l78Nz0tKRZyAiwTp3+Oaw/Xv/HsHKMdg9Y4R9EqqV8xPK kkNH5Hs8fno3Gbjr1V+/r6iTWoKbBBfdBZZtvG52ptGnT2HvlI8B2GHqZyD5yj9SSC1F X0vPYuHTVU65Sv+Tqp0cSPwxNXhHzRi0gqDDnDlDbmwFTjE+Pya/reracL2IHiFloUwl a9SgGd5h0RUZaB1x/bXlZl/nrwNnRJgtrYqHMU/LQVG63tJdHR5frE0BrfKV4+LDZazC 8QmM0rHh7k7YhN/1QpprWvTYW9XB+gw7c8STRzI7egfcwHeMQGXkyjCcv3mOQrbA6Po2 vT9g== X-Forwarded-Encrypted: i=1; AJvYcCVk4V6FChURP7Vjuak50QAYj49xdru39LGcJcwhhIKvr7lWGVXy/BIKyl/ZkY0jANJWBxZdVkQc8PRelczY9i5OZ5AdjmRiYQsj/d0G3k2dvnDnbWI= X-Gm-Message-State: AOJu0YwoqKOvUCqFf1NiAHezkeLGl7NfRCcc7vRAQrbiPSStCgFC0wpg CcYt1HIwUiYBaiECcPcLCD+R/duhr0mtzdZaEX2CGtI9YFCsC4ekPCsXXKjWLw== X-Google-Smtp-Source: AGHT+IE5trF99pt6yxLy0hVGziVuLU740Yhk23ir8obTxxE56RFdMfq2z26jixLlIL2miIGD5ezz0A== X-Received: by 2002:a05:620a:d82:b0:7a1:da71:e73a with SMTP id af79cd13be357-7a4e37605b0mr498168385a.2.1723551234290; Tue, 13 Aug 2024 05:13:54 -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.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 05:13:53 -0700 (PDT) From: Ricardo Ribalda Date: Tue, 13 Aug 2024 12:13:51 +0000 Subject: [PATCH 4/6] media: tc358746: Move clk_prepare to its own function MIME-Version: 1.0 Message-Id: <20240813-smatch-clock-v1-4-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_051355_737513_71F65FBA X-CRM114-Status: GOOD ( 13.52 ) 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; }