From patchwork Tue Aug 13 12:13:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13761929 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 3A587C52D7B for ; Tue, 13 Aug 2024 12:16:36 +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=LrZdtpz/qyn21riVVQ3i7W1bl9boREamJ7f5SQNbyMY=; b=zRLVUBifDGMlOpHiBY8wX7KcsL L9t6bipSE8O2lyM2r7QTBRaattxkanlevkXZ/KzhI7856eq4zale/kM8HN7AwgBY9RuftyEsljZyI dcpaM1CIdpIhZcAtURS2K+JsLvc9bqcyK4FFtu5Ty704Js2f02OcT2OZyZX+v62beq8jYwaTZD4At WgxFXtJ5Yh9y50jNVb2sKBQvdKJz+TD9+12vz1G5PF3605OILY9ghJ9nKtrry0X5pfedjK9n60Kuv X8994gwtsuLUEv3MjRYV3IOBkBhpTX0fOo9nRmo5zLPgNZ7Q3SpiqKHS7cJIPV74RXtkB+DcBOAEa b1gl/iHg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdqRu-00000003ewM-40t2; Tue, 13 Aug 2024 12:16:26 +0000 Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdqPS-00000003dzK-32Ts for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2024 12:13:56 +0000 Received: by mail-qk1-x72c.google.com with SMTP id af79cd13be357-7a1d7a544e7so365189085a.3 for ; Tue, 13 Aug 2024 05:13:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723551233; x=1724156033; 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=LrZdtpz/qyn21riVVQ3i7W1bl9boREamJ7f5SQNbyMY=; b=UN7r3H0/jIaJzWQL8+jiaZ0bqBOdrIpgiaASNM9LcYsrTZ6lJPS4WhwMMiYb18okWh lK3FaSez170wTAHC/Px2I8qn89In8ds/4JzgCfBYCNR6G1lOdkQgWkJxI9zl1hts70ER PnVTX5BsuzzUK7emV6R6OCgzp7M0B9DkEvxeA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723551233; x=1724156033; 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=LrZdtpz/qyn21riVVQ3i7W1bl9boREamJ7f5SQNbyMY=; b=XOIQN4ugbO1wRzTSEYf9fVvKNS6iBi4k3EQnUbtKS+x6HNhYPv+Wz+V4tFyinJUIXY m1vGOz+MkOD09cbuNuJLi6DjJASARet1l4vqZbI6G2S3xV4jsvHt8yc1Wiv9rs2RmfeY 4JPj/dMnu5ehGdlWSML9qBYAewPiHLUK8QAzdhAdUbZB9tqpiI2C3Th7h8FHaVXPs7n/ esJCFH5bE+fP90js1N+3tBZ26k/Ur23falNeiCCDNxwEhMyGrVjD6Slx0MzlVQ80wHNy Q0p8Q0J2xHceFM2mEWHHAoriPIAfYBDJ7BLbCBMiRbu8NAffGcXn+ljS4+I8TAtRxoLa 6MBA== X-Forwarded-Encrypted: i=1; AJvYcCV0dfzK5vyoOP9KufpKGXByNRHDueCVCFmBdWzKpZItN9648PT5lYeQFoz6Rb4dsRHoZLvHGgJxSfiUhrwxdiOi@lists.infradead.org X-Gm-Message-State: AOJu0YzNwPA5zFktyBvCGkWO1ZpHmXbzLwTSI5IDWelljU6N24+Qp3S+ 2q/OpoMIN60o3k6D3ulhV1JdiXdif4EBci6aZPXlA9MAjFluwAnO+41/i0gkpw== X-Google-Smtp-Source: AGHT+IFw/fFUPyShPG2/Ze40YU4KamjQKDfYMrBvg1bfZRKNcTmejJtMfWfYfhDU5SD5ItOdKzwbXQ== X-Received: by 2002:a05:620a:4043:b0:79f:515:e211 with SMTP id af79cd13be357-7a4e15bdc69mr410951685a.46.1723551233113; Tue, 13 Aug 2024 05:13:53 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 05:13:52 -0700 (PDT) From: Ricardo Ribalda Date: Tue, 13 Aug 2024 12:13:50 +0000 Subject: [PATCH 3/6] media: i2c: s5c73m3: Move clk_prepare to its own function MIME-Version: 1.0 Message-Id: <20240813-smatch-clock-v1-3-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_051354_800298_A262391B X-CRM114-Status: GOOD ( 12.95 ) 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/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; }