Commit 60613020 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Lee Jones
Browse files

leds: Convert all platform drivers to return void



The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

All platform drivers below drivers/leds/ unconditionally return zero in
their remove callback and so can be converted trivially to the variant
returning void.

Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230917130947.1122198-1-u.kleine-koenig@pengutronix.de


Signed-off-by: default avatarLee Jones <lee@kernel.org>
parent eccc489e
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -837,7 +837,7 @@ static int intel_sso_led_probe(struct platform_device *pdev)
	return 0;
}

static int intel_sso_led_remove(struct platform_device *pdev)
static void intel_sso_led_remove(struct platform_device *pdev)
{
	struct sso_led_priv *priv;
	struct sso_led *led, *n;
@@ -850,8 +850,6 @@ static int intel_sso_led_remove(struct platform_device *pdev)
	}

	regmap_exit(priv->mmap);

	return 0;
}

static const struct of_device_id of_sso_led_match[] = {
@@ -863,7 +861,7 @@ MODULE_DEVICE_TABLE(of, of_sso_led_match);

static struct platform_driver intel_sso_led_driver = {
	.probe		= intel_sso_led_probe,
	.remove		= intel_sso_led_remove,
	.remove_new	= intel_sso_led_remove,
	.driver		= {
			.name = "lgm-ssoled",
			.of_match_table = of_sso_led_match,
+2 −4
Original line number Diff line number Diff line
@@ -522,7 +522,7 @@ static int aat1290_led_probe(struct platform_device *pdev)
	return ret;
}

static int aat1290_led_remove(struct platform_device *pdev)
static void aat1290_led_remove(struct platform_device *pdev)
{
	struct aat1290_led *led = platform_get_drvdata(pdev);

@@ -530,8 +530,6 @@ static int aat1290_led_remove(struct platform_device *pdev)
	led_classdev_flash_unregister(&led->fled_cdev);

	mutex_destroy(&led->lock);

	return 0;
}

static const struct of_device_id aat1290_led_dt_match[] = {
@@ -542,7 +540,7 @@ MODULE_DEVICE_TABLE(of, aat1290_led_dt_match);

static struct platform_driver aat1290_led_driver = {
	.probe		= aat1290_led_probe,
	.remove		= aat1290_led_remove,
	.remove_new	= aat1290_led_remove,
	.driver		= {
		.name	= "aat1290",
		.of_match_table = aat1290_led_dt_match,
+2 −4
Original line number Diff line number Diff line
@@ -386,15 +386,13 @@ static int ktd2692_probe(struct platform_device *pdev)
	return 0;
}

static int ktd2692_remove(struct platform_device *pdev)
static void ktd2692_remove(struct platform_device *pdev)
{
	struct ktd2692_context *led = platform_get_drvdata(pdev);

	led_classdev_flash_unregister(&led->fled_cdev);

	mutex_destroy(&led->lock);

	return 0;
}

static const struct of_device_id ktd2692_match[] = {
@@ -409,7 +407,7 @@ static struct platform_driver ktd2692_driver = {
		.of_match_table = ktd2692_match,
	},
	.probe  = ktd2692_probe,
	.remove = ktd2692_remove,
	.remove_new = ktd2692_remove,
};

module_platform_driver(ktd2692_driver);
+2 −4
Original line number Diff line number Diff line
@@ -1016,7 +1016,7 @@ static int max77693_led_probe(struct platform_device *pdev)
	return ret;
}

static int max77693_led_remove(struct platform_device *pdev)
static void max77693_led_remove(struct platform_device *pdev)
{
	struct max77693_led_device *led = platform_get_drvdata(pdev);
	struct max77693_sub_led *sub_leds = led->sub_leds;
@@ -1032,8 +1032,6 @@ static int max77693_led_remove(struct platform_device *pdev)
	}

	mutex_destroy(&led->lock);

	return 0;
}

static const struct of_device_id max77693_led_dt_match[] = {
@@ -1044,7 +1042,7 @@ MODULE_DEVICE_TABLE(of, max77693_led_dt_match);

static struct platform_driver max77693_led_driver = {
	.probe		= max77693_led_probe,
	.remove		= max77693_led_remove,
	.remove_new	= max77693_led_remove,
	.driver		= {
		.name	= "max77693-led",
		.of_match_table = max77693_led_dt_match,
+2 −3
Original line number Diff line number Diff line
@@ -855,12 +855,11 @@ static int mt6360_led_probe(struct platform_device *pdev)
	return ret;
}

static int mt6360_led_remove(struct platform_device *pdev)
static void mt6360_led_remove(struct platform_device *pdev)
{
	struct mt6360_priv *priv = platform_get_drvdata(pdev);

	mt6360_v4l2_flash_release(priv);
	return 0;
}

static const struct of_device_id __maybe_unused mt6360_led_of_id[] = {
@@ -875,7 +874,7 @@ static struct platform_driver mt6360_led_driver = {
		.of_match_table = mt6360_led_of_id,
	},
	.probe = mt6360_led_probe,
	.remove = mt6360_led_remove,
	.remove_new = mt6360_led_remove,
};
module_platform_driver(mt6360_led_driver);

Loading