From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 EB52C402432 for ; Wed, 17 Jun 2026 13:02:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781701336; cv=none; b=C+3dLc8Ddx+Xq3foWJAkw9TR+gGKFIAb2OumS3AklT7dCLZ+QA0LrfkeSWejHCcZ6Vl3ziUutYEGWPA00tVDaXVyrwstIr3Qk8PDXTYx4IP7C92lXgEpzeX5SEX1JSvfvM5hrh8K8+xchHnnWJEsV7KsZcceQnG1j/hMLnHPjbk= 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.44 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-f44.google.com with SMTP id 5b1f17b1804b1-490b64c8311so55927505e9.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=UbcDSpMp77LsR+EVWbw70ifbe2SMTPkhsn0x2RAeCdD41TLiuL7mBuGR5j99Z7xbVR FvRcDtOOb8UQ1uGSioFWRq1OWiN/rKCa6GtnSKAdgZKyEkWEz1yDn7I1TG3K88nF9IV/ rrhbDesDojNnAhYlClcUKZm2ptamcmEZGRs+2ZHMuiQSzbskTvJugEIMUJUoRdPsuSOL 3pj6oyLtfQLgM/ONRo6X908XZ+6O15Ey13I+ucWJXNO+zFQKEwfWl05bozXSdskwf/HG pJ/NrXiaULGMWdnu181LT5xe3P1JZ77OXy60HGFvjFgSBS+gtggfQM4WzBy0SoDoeV/2 5gVw== X-Forwarded-Encrypted: i=1; AFNElJ9xULF4vBvu3XLgZ9GUtRLWivBsGsTn9HCmABswxOr0/POdWK2J1AWQVvaeWkGHRmmj9/aVVPfCU+NIGxrx@vger.kernel.org X-Gm-Message-State: AOJu0YxftVNOBm4GuPjMzogojb5SI5mwt8G7mBgWVvCCE9pWgiuStEVA mer7JAVJpfo0+dzmR4vHQ1JNOA9FlVVzrCxosrTIdGGt2yorOlJRAHcu X-Gm-Gg: Acq92OHhSQu4rqVOvXNrxytI1RINU6EeajCxEHy1ROp92UBW55m4Rd5ZCpinL7qtH+r EGU2YwXCxJVr4B5bPzcyzXPLFqljQRV4ln1OrPy/OilbJozW3KCH7LHRXi2ZdyZuXOEFJEAY2uU YWShxWYilNbemNurcSPIHfhxwSIQpK2XXsfGR9+THtn/3Ax+5S2rKRzOJu4ZopE3T5xtoEybFua xAAtS772KuFRbgdoAKPrT9NJ5cXxvJuseexAEI96wnAU0hz2EoJBXmWQGFM48cxz6pp6indrQL1 8aj7sviKupCrLTD9R4wv8jGKfoJyxrdhENTeZPboUS2JTzQjGMe9h1DAu8+RPYfi6YyHJOsNauK CbPMwzKjskQU46iIKoCQb/iE/M2ykhdKy/sBmuRhZ0dt5rq0tQwSvF4N12pDeUyYZVY/oq2hVwj Aobl264fQpY+6iftTtq3o4YY56sPbgYDQgL9CFqJggTQoiRIQj3g== 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-arm-msm@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 >