From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 25143402457 for ; Wed, 17 Jun 2026 13:02:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781701336; cv=none; b=BM/UL/tL27uRm9yLnZJ6sk40Quv39ZIYWGqfJMLlxsnNE1bmCusEWRL8IMr6GQ6itYHGrrk3WyxFqRjS+Lwx3zQemf4Lxt+jZgKUxSQgL8+NeNvwLC5qZD5wzJJhkhMdJylzaT2Q9gpWzM4Hu6UQiLdAxiPo216preRat2FIIC8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781701336; c=relaxed/simple; bh=ER7cBoORTtCo7YHQmTGpBnqKr/GhDtCtpgQSSh5vv20=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lBRB5cPURJXun9ke6OcovBP1/yEHrRRWB55l5hWHQ9QqC9cQNfjs33uq91alV1kGgAVJH0cAZ11cK6Z6G7xBDxBIwPpH5+rFXIYjeJusln0CtsP2QvX7gM83RvTlyuBUDxzdEbgCxdDZVEY+yd0VkJsZVHJfSdJkg6lsgW74MhQ= 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=L1iKvp6n; arc=none smtp.client-ip=209.85.128.45 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="L1iKvp6n" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-490b64c8311so55927545e9.3 for ; Wed, 17 Jun 2026 06:02:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781701333; x=1782306133; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=KoyHU0/MnlEjPkHmAG8qUfE8grsoj3Z59or+Bu6rF3E=; b=L1iKvp6n911t1/z4RYAVzXONkBcZHcMSNrWXpD0u2bS8HOIQ34kFk7X6awUB7pVQ4N 218Ufk2su+5ij6kCRPLZjz78DZLtdmj3inQiOglyjBdUQU0JHf0/mYn+kA24ZCYXBHr5 YtrftHA6ZH02alaH3DcjucF/kG+P1w2EeFx6SjPdzy9Wirc2NrZm72ONjLZbj5zlk0eA KotaMTkmVn8gCxyhqoGzKbgjItmnAGfVe0zww95D854sqmHW81mMRZoPZ/GRvRNrsQZq oyA6CMMkDvVh9yc6+lFS1nyOVqchpQkZN3G6Z/5V1Fye/gghO4QsTxvL8XpUyYXjqBEq 1zSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781701333; x=1782306133; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=KoyHU0/MnlEjPkHmAG8qUfE8grsoj3Z59or+Bu6rF3E=; b=A1uFv2PA3luxe1K+aKPWZCUvaEa71SXCJ58ag44rpnKzsiYBqpCNl17gpx+2ru1wSE 3nmJ/j7ZhYq3WCBF6lN6OVyuJzgLn6co3Ki0QAHfxnUIbCGagvSbhVLjm1tlIF/qI0TM QQynXzif2nOSb1t6CaRLNjYcVHc3aGwHcAY0rlg5Cp78qikMdfSLp6YQljw+oAifb+rU du7TpDuEYj8cL+0jOaP0HpBpai9vN1g3uafA6S3tATpWyWacSMsWpyHnfxNfI+tMuZFU n9J8Ud36lb3fbcdW/cb8IUYncAEND8tvzrue3txk+wE17hLA/hKwjx4Bcz9pMMCY+m/t x6vQ== X-Forwarded-Encrypted: i=1; AFNElJ8iBqzeSbGgZwV7ljL4FpN3Wp57o/9DgPOiy+ZqYt/rgJlS1ynXEsjIRlNhMER1Ua1Qhve1YJ2nfgYpqUs=@vger.kernel.org X-Gm-Message-State: AOJu0YxPRAEraE7hXIlrIkiY+5voFWeUbaGWhMBNjK2Q/sFSVUyTnV+T meQSLrmyZJecYeoHhu5ORbokHD/3bdDQRJdCzpzyvoYgI7L1oFI0Ri7n X-Gm-Gg: Acq92OHrZ/MfBdGaRj1GE6rjPQTP9/m0KRsUjFvQ3OkvzARamaKICV2b5ZrNroGouep RlUwt15pB43rO/R42faQ8ohjK7GUAyijovjXWE70dgkGtVVB/x4XSNcNvGpVFyQubPjGK28mBHe Yt6S3ZPAcxCGzj+WB6MXzjBSS0Uv7SNVZEejq3i7IrtbAfeSo8MlS/yP6PalCd2wIl1VF+zJvq3 PFyD21XIPTt59tGWnTPmBwe11lY9shyHCMCOEbwENtqHHSBSOOEkRM5DTNTxXn4mUsfdc0v7n8S PjTzMYgXDVn5xH+17jrZwbKOlWeUI4xqa035gzbKJYvHWqbRbh1vdNA2+p8S5QTq6aZzq62xmQb jl51am37nfpAlFEcmqdXOCt44dTKEFvI+kTD658V88V8DR550QSayp2Mu7xVegJMBF2RXRJkSLh T7ykCfTvo4oFnagE1wsZMlv4Li4Uap1X5dZ7r7bbgR/rPpDCdc9w== X-Received: by 2002:a05:600c:8189:b0:492:32a0:7f92 with SMTP id 5b1f17b1804b1-492333aabe8mr70111375e9.12.1781701332662; Wed, 17 Jun 2026 06:02:12 -0700 (PDT) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49230a4ff67sm157906775e9.6.2026.06.17.06.02.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2026 06:02:11 -0700 (PDT) Date: Wed, 17 Jun 2026 14:02:09 +0100 From: David Laight To: Charles Keepax Cc: phucduc.bui@gmail.com, Mark Brown , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Cheng-Yi Chiang , Tzung-Bi Shih , Guenter Roeck , Benson Leung , David Rhodes , Richard Fitzgerald , povik+lin@cutebit.org, Support Opensource , Nick Li , Herve Codina , Srinivas Kandagatla , Matthias Brugger , AngeloGioacchino Del Regno , Shenghao Ding , Kevin Lu , Baojun Xu , Sen Wang , Oder Chiou , Lars-Peter Clausen , nuno.sa@analog.com, Steven Eckhoff , patches@opensource.cirrus.com, chrome-platform@lists.linux.dev, asahi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH 15/78] ASoC: codecs: cs42l43: Use guard() for mutex locks Message-ID: <20260617140209.3f89706c@pumpkin> In-Reply-To: References: <20260617103235.449609-1-phucduc.bui@gmail.com> <20260617103235.449609-16-phucduc.bui@gmail.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 17 Jun 2026 11:57:49 +0100 Charles Keepax wrote: > On Wed, Jun 17, 2026 at 05:31:32PM +0700, phucduc.bui@gmail.com wrote: > > From: bui duc phuc > > > > Clean up the code using guard() for mutex locks. > > Merely code refactoring, and no behavior change. > > > > Signed-off-by: bui duc phuc > > --- > > @@ -913,17 +908,13 @@ int cs42l43_jack_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *u > > if (override >= e->items) > > return -EINVAL; > > > > - mutex_lock(&priv->jack_lock); > > + guard(mutex)(&priv->jack_lock); > > I believe you have to use scoped_guard here, as there is a return > from the function above, if memory serves it attempts to release > the mutex on that path despite it being above the guard. Indeed. I believe clang will complain. That makes these mechanical conversions of existing code dangerous churn. While using guard() (etc) can make it easier to ensure the lock is released when functions have multiple error exits, I'm not convinced it makes the code any easier to read (other people may disagree). David > > Be worth having a quick scan through the rest of the series for > this as well. > > Thanks, > Charles >