From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 79DD2158869; Tue, 9 Jul 2024 11:19:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720523965; cv=none; b=B9C8ioCNs/0V8gN3Mg42pDkh0Xbc8ejtR3prgq3QIZPRWIhBpWo1fI7dd2HMmw7XgXnlhH/puE6SLxFg6Jn/xbuHFZPL1q4eleGjZjIjbGQMTaqqUBO7Fa+b5EOID236utAvPyzZkdqkpG5DyVvQELeFKy5wrz1xQ1ZVzH1Jh0Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720523965; c=relaxed/simple; bh=JqqY3WqzVZVhs3snOOwhiP5opXrFp2O0nOrOSpaSnQ8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EeMk7MggSPJQ9ZuJtQ8BYUH1ydrrFBgSc0RS7d/jwhLf1Zgg4UZomumGrWRo81kc6YbuBBqtEmZ40+i48vbXHR2Q0ctDDbbyQgZGSLBYrOb4ob+4U/OydaTO7ed0seAB0qaRavoDmRFA1TAW6JjmoDtb7fZ9LxDOSt/7oOdNF5E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=mZmCEWnL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="mZmCEWnL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AFEAEC32786; Tue, 9 Jul 2024 11:19:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1720523965; bh=JqqY3WqzVZVhs3snOOwhiP5opXrFp2O0nOrOSpaSnQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mZmCEWnLWIIHszfRYn/sEXqLLLr1Kdvr+eIrYwlNCX58ViPJiXUjV7XzqSXBnXd7r iM05CezG4YHtU5gu5ps/Dd/ZrYjEW5Zc1u0PiW6bRyc8mVwZOYJnKSZxMxSMwejSWV JRAa1QRXVNxOfqx+dUIAyYHQ4oxTFS67QT7y8EFs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, George Stark , Andy Shevchenko , Lee Jones , Sasha Levin Subject: [PATCH 6.9 003/197] leds: mlxreg: Use devm_mutex_init() for mutex initialization Date: Tue, 9 Jul 2024 13:07:37 +0200 Message-ID: <20240709110709.038309619@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240709110708.903245467@linuxfoundation.org> References: <20240709110708.903245467@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: George Stark [ Upstream commit efc347b9efee1c2b081f5281d33be4559fa50a16 ] In this driver LEDs are registered using devm_led_classdev_register() so they are automatically unregistered after module's remove() is done. led_classdev_unregister() calls module's led_set_brightness() to turn off the LEDs and that callback uses mutex which was destroyed already in module's remove() so use devm API instead. Signed-off-by: George Stark Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20240411161032.609544-8-gnstark@salutedevices.com Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/leds/leds-mlxreg.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/leds/leds-mlxreg.c b/drivers/leds/leds-mlxreg.c index 5595788d98d20..1b70de72376cc 100644 --- a/drivers/leds/leds-mlxreg.c +++ b/drivers/leds/leds-mlxreg.c @@ -256,6 +256,7 @@ static int mlxreg_led_probe(struct platform_device *pdev) { struct mlxreg_core_platform_data *led_pdata; struct mlxreg_led_priv_data *priv; + int err; led_pdata = dev_get_platdata(&pdev->dev); if (!led_pdata) { @@ -267,26 +268,21 @@ static int mlxreg_led_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; - mutex_init(&priv->access_lock); + err = devm_mutex_init(&pdev->dev, &priv->access_lock); + if (err) + return err; + priv->pdev = pdev; priv->pdata = led_pdata; return mlxreg_led_config(priv); } -static void mlxreg_led_remove(struct platform_device *pdev) -{ - struct mlxreg_led_priv_data *priv = dev_get_drvdata(&pdev->dev); - - mutex_destroy(&priv->access_lock); -} - static struct platform_driver mlxreg_led_driver = { .driver = { .name = "leds-mlxreg", }, .probe = mlxreg_led_probe, - .remove_new = mlxreg_led_remove, }; module_platform_driver(mlxreg_led_driver); -- 2.43.0