From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1E993672B3 for ; Wed, 1 Jul 2026 04:13:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782879228; cv=none; b=MbbA3YzQDkoohLmU/evDEDC37owofnGtKid1SlXBpcuBMt+HkPBCtChD/SULd4GxXHC3D18j7pEhw107/2cm2ISIQltkbW49HB1RlVbCXB66PEAMrrQ4UIfefX2SlWMOGr3t4kgjFpBn1Ql9F39Ot3mwILLX7Ocg7eaWjlSQzi4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782879228; c=relaxed/simple; bh=3FZXWlaazKVVXGqsOlt9bSZxHzxITSsi9n2VSGvSEt0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S8fnOu/VXVrErJ1WG1atNaIHxOiLoOURc2RD0zwWpGlSE2dX0shvE9PSx+Gy5C1ar1YWd6GlgSD1+SqA8VEOcBpehI2FA2VnrImfLY5ZGyrzR9nrWpVzTH8Oj8jts002QX7hPGSRaTaCa70xXhiLx7mdMCzRX/WXBCiMUXHdAr0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DXdikm3/; arc=none smtp.client-ip=209.85.216.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DXdikm3/" Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-37f7a5a217fso136491a91.0 for ; Tue, 30 Jun 2026 21:13:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782879223; x=1783484023; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=0EeZZoz/UdMq6CHL5sceatvsRmFwz3qbQS7Oo/q8Ly4=; b=DXdikm3/EWVCuGx9AW3BGtg9pmJ9YuduBZOsYATzFgMP64eL9wobLXiI3lwoB+irAh VDtRyg4I/GgAP6FU/M80KG+eRqJNduPC/eVNe0xqD7m7UTdVs9HShOELnTHSvB8zWyKW i1ifNGOdohydkPuMZ6Ahi9f2jpDy8cbL3NNzzIee+3msQfOJuIgNwPXi4gfqcxFQuRGo x+ZoD0ZzUmGQeBsd3sn0jW2JgsLyZTK4zdnhDS6EKXgY9/2P4wYhuKEWW7xEf+qdDd68 9Uk2xlST/wjb8x807LN6LhdhU05Elk0Y4ARIxMuQSk+pbvWfMQl8ZKWbAku9cTtDLPcO MfEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782879223; x=1783484023; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=0EeZZoz/UdMq6CHL5sceatvsRmFwz3qbQS7Oo/q8Ly4=; b=fRwJDZHoW8iio2tJRPN56AEizR5Z9WihUjAQXhFFH/4yOM+o9vuI5hZbH++wTVnHH0 AP/KEzfqy2+IErki6CJPeTDgYgocTDm1REHBMs9308G1YAY6CK01pFKiaSbCnAxXZKsi dLvyfV/VYykdtX/Ogv3WqdpU5NT+YQXSt21+Aw79c1zC/ffMQIQEctbMhIvDBLaQpMED 9bkaaCqc6TUZbfOCquc0RGh3hVqcWLzIlnnz0V6C0ZQPsYYT8IYh4H2PwXfJsIlr3k/Z pCoPcSKwUnkcc1i6OfoVg8eMOytKHvpmdKCM+HcKOq/hVj64Sby0aUFlGCDP4oLQ3L/m 4K1g== X-Forwarded-Encrypted: i=1; AHgh+RooMC8yuyEVycigD7M0IwWea5nm63YiE3n5VLoBuvhyRaIfOr8DXolIPkavpJ3KP50vUzSWdEPS3XE9C2M=@vger.kernel.org X-Gm-Message-State: AOJu0YwzmNHfLulixXDASA9Y+3oPSBYVMvQdHjVNfFn+ww4HPDohYC/Z tqRFSlrSs2vTB1jTu8pKgoSQ9q/ftMM3UkpgUBwoDSLAeAJxcI5wVtXw X-Gm-Gg: AfdE7cl8Al20WMP0JPUvneSgGhipvZA5346quwNozDct9EbGI34rCXMX6TcZXzTJNAp CFJkStIbab6KZeGc8BFQW3cOlU6MdMGvY1Lsv/RUacfCzBGmKtAgO2w14KVZPkqwZKL0iDrpPht YtHU+SXbjx1c+HuAapmgbD3ykfM0X8JXBrw+nD2WB18cKhy2dJKHtcWLqGB1+x4VWEj7ur8vSxH psdFMNRCHAHy1y+0GEIgE45hQcHMk7NebM0MaHg0Zv18bH2scpMX1OrI0+Is2pyobc4c1iCYN2D lZUPXihrRuxXSP1y2DOfxMYxxQJ2owUN752McaW03jNQ2ahWqYAoHY3nGs8aMLIRMLmrvFsgAH2 ye55evtU/yd5UkqOz3JrK67RIz+3aAfFn7Om7h+1c6xM15Dofnp+gcfU7+AcsErgo82EoxPKMpa mvG2ToQTSFFwEJNv1Qvji4ciL5DOkMu2KQvxrO8DFWNZKr91c= X-Received: by 2002:a17:90b:4cc2:b0:37f:9ce1:735d with SMTP id 98e67ed59e1d1-380aa219fecmr81787a91.30.1782879222734; Tue, 30 Jun 2026 21:13:42 -0700 (PDT) Received: from phuc-desktop.. ([183.91.15.56]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38095e830ddsm963128a91.13.2026.06.30.21.13.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2026 21:13:42 -0700 (PDT) From: phucduc.bui@gmail.com To: Sylwester Nawrocki , Liam Girdwood , Mark Brown , Jaroslav Kysela Cc: Takashi Iwai , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Sen Wang , Jarkko Nikula , bui duc phuc Subject: [PATCH 1/2] ASoC: samsung: i2s: Avoid mixing goto with guard() Date: Wed, 1 Jul 2026 11:13:09 +0700 Message-ID: <20260701041310.230725-2-phucduc.bui@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260701041310.230725-1-phucduc.bui@gmail.com> References: <20260701041310.230725-1-phucduc.bui@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: bui duc phuc cleanup.h recommends not mixing goto-based error handling with cleanup helpers in the same function. Remove the goto path and rely on guard(pm_runtime) for automatic cleanup instead. Fixes: 3d08517b5c67 ("ASoC: samsung: i2s: Use guard() for spin locks") Signed-off-by: bui duc phuc --- sound/soc/samsung/i2s.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index f80f697a5d55..f80e8d498156 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -512,7 +513,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int rfs, u32 mod, mask, val = 0; int ret = 0; - pm_runtime_get_sync(dai->dev); + guard(pm_runtime_active)(dai->dev); scoped_guard(spinlock_irqsave, &priv->lock) mod = readl(priv->addr + I2SMOD); @@ -537,8 +538,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int rfs, && (mod & cdcon_mask))))) { dev_err(&i2s->pdev->dev, "%s:%d Other DAI busy\n", __func__, __LINE__); - ret = -EAGAIN; - goto err; + return -EAGAIN; } if (dir == SND_SOC_CLOCK_IN) @@ -566,7 +566,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int rfs, } else { priv->rclk_srcrate = clk_get_rate(priv->op_clk); - goto done; + return 0; } } @@ -580,14 +580,14 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int rfs, if (WARN_ON(IS_ERR(priv->op_clk))) { ret = PTR_ERR(priv->op_clk); priv->op_clk = NULL; - goto err; + return ret; } ret = clk_prepare_enable(priv->op_clk); if (ret) { clk_put(priv->op_clk); priv->op_clk = NULL; - goto err; + return ret; } priv->rclk_srcrate = clk_get_rate(priv->op_clk); @@ -595,11 +595,10 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int rfs, || (clk_id && !(mod & rsrc_mask))) { dev_err(&i2s->pdev->dev, "%s:%d Other DAI busy\n", __func__, __LINE__); - ret = -EAGAIN; - goto err; + return -EAGAIN; } else { /* Call can't be on the active DAI */ - goto done; + return 0; } if (clk_id == 1) @@ -607,8 +606,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int rfs, break; default: dev_err(&i2s->pdev->dev, "We don't serve that!\n"); - ret = -EINVAL; - goto err; + return -EINVAL; } scoped_guard(spinlock_irqsave, &priv->lock) { @@ -616,13 +614,8 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int rfs, mod = (mod & ~mask) | val; writel(mod, priv->addr + I2SMOD); } -done: - pm_runtime_put(dai->dev); return 0; -err: - pm_runtime_put(dai->dev); - return ret; } static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) -- 2.43.0