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 BD543157A72; Tue, 9 Jul 2024 11:11:31 +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=1720523492; cv=none; b=nJu+7f3niq+cczkAvyAmTzbisFAdZDO80GdnnMtdVRWe3IA9AQz5OX08kO6XAJmOeKh0vnHlxnXp5ZZPpxO6MMjXZKJxlvBQauJT6GeUuXkUcgWUaO4IUD5q6LYgbh1ofgXfWebQ/hXuqXap4tf1ijcN3m6HwrjrYe8BLro7wbI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720523492; c=relaxed/simple; bh=niR2OXjK++j8s4zbuZ6uIu+3nwACSAqJ1DGn9loQ5oQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZGg+RYwfz3hs0Zh1YxxxrsJ3930c8cYaoeptKfYBJispdKxBFnxJa4qf8AfU1AeJXOC1aYg9bPU7AZdKNYoT5+ZkQs2Z/+haW8es6q6k1Gohk35WAkRDVRpdUvfqGiRmM6eimx1kH2+wMeSKbGMjsk0t/DPW74WsLWtp6FI35u4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=WLBYjATS; 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="WLBYjATS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB83CC3277B; Tue, 9 Jul 2024 11:11:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1720523491; bh=niR2OXjK++j8s4zbuZ6uIu+3nwACSAqJ1DGn9loQ5oQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WLBYjATSm8LwtlA6kOjr7eSrgIXkGCE14CEMZX1U07EQVIJkAg6vrvRFt9wt81bmg ycbk4yFLoWX32pUWdUAQHH107yY6gyvPB3HPekXLoIbB5lrpD6b6vjBMDpE6k7xqJd 2Pgpn/O2uF/lNWmDg+HGEGmnMb6B7JR5QbIPNsUs= 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.6 002/139] leds: an30259a: Use devm_mutex_init() for mutex initialization Date: Tue, 9 Jul 2024 13:08:22 +0200 Message-ID: <20240709110658.243832346@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240709110658.146853929@linuxfoundation.org> References: <20240709110658.146853929@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.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: George Stark [ Upstream commit c382e2e3eccb6b7ca8c7aff5092c1668428e7de6 ] 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-9-gnstark@salutedevices.com Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/leds/leds-an30259a.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/leds/leds-an30259a.c b/drivers/leds/leds-an30259a.c index 0216afed3b6e7..decfca447d8a7 100644 --- a/drivers/leds/leds-an30259a.c +++ b/drivers/leds/leds-an30259a.c @@ -283,7 +283,10 @@ static int an30259a_probe(struct i2c_client *client) if (err < 0) return err; - mutex_init(&chip->mutex); + err = devm_mutex_init(&client->dev, &chip->mutex); + if (err) + return err; + chip->client = client; i2c_set_clientdata(client, chip); @@ -317,17 +320,9 @@ static int an30259a_probe(struct i2c_client *client) return 0; exit: - mutex_destroy(&chip->mutex); return err; } -static void an30259a_remove(struct i2c_client *client) -{ - struct an30259a *chip = i2c_get_clientdata(client); - - mutex_destroy(&chip->mutex); -} - static const struct of_device_id an30259a_match_table[] = { { .compatible = "panasonic,an30259a", }, { /* sentinel */ }, @@ -347,7 +342,6 @@ static struct i2c_driver an30259a_driver = { .of_match_table = an30259a_match_table, }, .probe = an30259a_probe, - .remove = an30259a_remove, .id_table = an30259a_id, }; -- 2.43.0