From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fllvem-ot03.ext.ti.com (fllvem-ot03.ext.ti.com [198.47.19.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D564118BBB9 for ; Mon, 9 Jun 2025 21:12:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.245 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749503538; cv=none; b=MaX0yZlKoVOdCg6Vq8oUR/i8SLhu52G4qtns0fKyeB8mHSKYHLDPPphT2QXdoZ+fcCiSb2Y5JxFxszdTCfeo6LSFX1RbIcM/7vLZyXWidovZu7j1nTJS/Krd6U38M3r+JVAdSXZ6s83O3RKSe4eNOz6DEYtUiOQ7NC5dzneWRn0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749503538; c=relaxed/simple; bh=v7Wyj6Fr90JtaXx9mPLXXO6DL0XRpjX4OlNToy9WZjY=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=rD3sx5m9ZC954Gb30b6f0R8Gco6JwOqycLhUxS7ngWgwzJhSR+HgoqJd3b4g/ZkIpvb97gdDwYy94HuOIGEF0ylGN/Ewnq7/+GfY/XO5V6lw1pTLzaXAxIlhrMyAOfm2jiAc3EyJVUJO8cvF57hfk97foGmhol09DKuQiZdz9oU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=OUWpIJ+g; arc=none smtp.client-ip=198.47.19.245 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="OUWpIJ+g" Received: from fllvem-sh03.itg.ti.com ([10.64.41.86]) by fllvem-ot03.ext.ti.com (8.15.2/8.15.2) with ESMTP id 559LBqg12102748; Mon, 9 Jun 2025 16:11:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1749503512; bh=46ToyLg6oP+8zwm16diPabgfMuXMygGMCndJmaqJXRs=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=OUWpIJ+gkR23sr1WZH3XJOiD/1ICYbhXvrJRY/rFW2cnGm9SKgz7Gegvu2AZ05vmw 6F4qfYUZFF7VVEM75LWcXJ2qe1UQZdjnRVJCjrzsmH7cMxh5r2iJx+c0sVsTVqFFgo mz8dkAxYbReDt9bCcA+4cIwIoXoNny+m56ljEwj0= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by fllvem-sh03.itg.ti.com (8.18.1/8.18.1) with ESMTPS id 559LBptj3958032 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA256 bits=128 verify=FAIL); Mon, 9 Jun 2025 16:11:51 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 9 Jun 2025 16:11:51 -0500 Received: from lelvem-mr06.itg.ti.com (10.180.75.8) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 9 Jun 2025 16:11:51 -0500 Received: from [10.249.42.149] ([10.249.42.149]) by lelvem-mr06.itg.ti.com (8.18.1/8.18.1) with ESMTP id 559LBoxI1847054; Mon, 9 Jun 2025 16:11:50 -0500 Message-ID: <1983260a-4362-44ca-af1a-0e20d2fee6db@ti.com> Date: Mon, 9 Jun 2025 16:11:49 -0500 Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 2/3] leds: lp8860: Check return value of devm_mutex_init() To: =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , Peter Zijlstra , Ingo Molnar , Waiman Long , Boqun Feng , Vicentiu Galanopulo , Will Deacon , Han Xu , Haibo Chen , Yogesh Gaur , Mark Brown , Lee Jones , Pavel Machek CC: Andy Shevchenko , , Bartosz Golaszewski , Bartosz Golaszewski , , , References: <20250609-must_check-devm_mutex_init-v6-0-9540d5df9704@weissschuh.net> <20250609-must_check-devm_mutex_init-v6-2-9540d5df9704@weissschuh.net> Content-Language: en-US From: Andrew Davis In-Reply-To: <20250609-must_check-devm_mutex_init-v6-2-9540d5df9704@weissschuh.net> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea On 6/9/25 3:38 PM, Thomas Weißschuh wrote: > Even if it's not critical, the avoidance of checking the error code > from devm_mutex_init() call today diminishes the point of using devm > variant of it. Tomorrow it may even leak something. > > Add the missed check. > > Fixes: 87a59548af95 ("leds: lp8860: Use new mutex guards to cleanup function exits") > Signed-off-by: Thomas Weißschuh > --- > drivers/leds/leds-lp8860.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/leds/leds-lp8860.c b/drivers/leds/leds-lp8860.c > index 52b97c9f2a03567aa12d4f63a951593a5e7017d5..0962c00c215a11f555a7878a3b65824b5219a1fa 100644 > --- a/drivers/leds/leds-lp8860.c > +++ b/drivers/leds/leds-lp8860.c > @@ -307,7 +307,9 @@ static int lp8860_probe(struct i2c_client *client) > led->client = client; > led->led_dev.brightness_set_blocking = lp8860_brightness_set; > > - devm_mutex_init(&client->dev, &led->lock); > + ret = devm_mutex_init(&client->dev, &led->lock); > + if (ret) > + return dev_err_probe(&client->dev, ret, "Failed to initialize lock\n"); I don't think the lock initialization can actually fail, if anything ever breaks it will be the devm allocation, which is a ENOMEM situation, so probably not worth printing anything. Either way is fine for __must_check sake so, Acked-by: Andrew Davis > > led->regmap = devm_regmap_init_i2c(client, &lp8860_regmap_config); > if (IS_ERR(led->regmap)) { >