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 (mostly) ignored
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.
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/thermal/amlogic_thermal.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_thermal.c
index 756b218880a7..a95c8959e5af 100644
--- a/drivers/thermal/amlogic_thermal.c
+++ b/drivers/thermal/amlogic_thermal.c
@@ -293,11 +293,11 @@ static int amlogic_thermal_probe(struct platform_device *pdev)
return ret;
}
-static int amlogic_thermal_remove(struct platform_device *pdev)
+static void amlogic_thermal_remove(struct platform_device *pdev)
{
struct amlogic_thermal *data = platform_get_drvdata(pdev);
- return amlogic_thermal_disable(data);
+ amlogic_thermal_disable(data);
}
static int __maybe_unused amlogic_thermal_suspend(struct device *dev)
@@ -324,7 +324,7 @@ static struct platform_driver amlogic_thermal_driver = {
.of_match_table = of_amlogic_thermal_match,
},
.probe = amlogic_thermal_probe,
- .remove = amlogic_thermal_remove,
+ .remove_new = amlogic_thermal_remove,
};
module_platform_driver(amlogic_thermal_driver);
--
2.39.0
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 (mostly) ignored
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.
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/thermal/dove_thermal.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c
index 9954040d1d2c..526c96fd4cc5 100644
--- a/drivers/thermal/dove_thermal.c
+++ b/drivers/thermal/dove_thermal.c
@@ -158,21 +158,19 @@ static int dove_thermal_probe(struct platform_device *pdev)
return 0;
}
-static int dove_thermal_exit(struct platform_device *pdev)
+static void dove_thermal_exit(struct platform_device *pdev)
{
struct thermal_zone_device *dove_thermal =
platform_get_drvdata(pdev);
thermal_zone_device_unregister(dove_thermal);
-
- return 0;
}
MODULE_DEVICE_TABLE(of, dove_thermal_id_table);
static struct platform_driver dove_thermal_driver = {
.probe = dove_thermal_probe,
- .remove = dove_thermal_exit,
+ .remove_new = dove_thermal_exit,
.driver = {
.name = "dove_thermal",
.of_match_table = dove_thermal_id_table,
--
2.39.0
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 (mostly) ignored
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.
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/thermal/tegra/soctherm.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c
index ea66cba09e56..e7fe8683bfc5 100644
--- a/drivers/thermal/tegra/soctherm.c
+++ b/drivers/thermal/tegra/soctherm.c
@@ -2219,15 +2219,13 @@ static int tegra_soctherm_probe(struct platform_device *pdev)
return err;
}
-static int tegra_soctherm_remove(struct platform_device *pdev)
+static void tegra_soctherm_remove(struct platform_device *pdev)
{
struct tegra_soctherm *tegra = platform_get_drvdata(pdev);
debugfs_remove_recursive(tegra->debugfs_dir);
soctherm_clk_enable(pdev, false);
-
- return 0;
}
static int __maybe_unused soctherm_suspend(struct device *dev)
@@ -2274,7 +2272,7 @@ static SIMPLE_DEV_PM_OPS(tegra_soctherm_pm, soctherm_suspend, soctherm_resume);
static struct platform_driver tegra_soctherm_driver = {
.probe = tegra_soctherm_probe,
- .remove = tegra_soctherm_remove,
+ .remove_new = tegra_soctherm_remove,
.driver = {
.name = "tegra_soctherm",
.pm = &tegra_soctherm_pm,
--
2.39.0
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 (mostly) ignored
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.
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/thermal/rzg2l_thermal.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/thermal/rzg2l_thermal.c b/drivers/thermal/rzg2l_thermal.c
index b56981f85306..a723eaff78e5 100644
--- a/drivers/thermal/rzg2l_thermal.c
+++ b/drivers/thermal/rzg2l_thermal.c
@@ -150,14 +150,12 @@ static void rzg2l_thermal_reset_assert_pm_disable_put(struct platform_device *pd
reset_control_assert(priv->rstc);
}
-static int rzg2l_thermal_remove(struct platform_device *pdev)
+static void rzg2l_thermal_remove(struct platform_device *pdev)
{
struct rzg2l_thermal_priv *priv = dev_get_drvdata(&pdev->dev);
thermal_remove_hwmon_sysfs(priv->zone);
rzg2l_thermal_reset_assert_pm_disable_put(pdev);
-
- return 0;
}
static int rzg2l_thermal_probe(struct platform_device *pdev)
@@ -242,7 +240,7 @@ static struct platform_driver rzg2l_thermal_driver = {
.of_match_table = rzg2l_thermal_dt_ids,
},
.probe = rzg2l_thermal_probe,
- .remove = rzg2l_thermal_remove,
+ .remove_new = rzg2l_thermal_remove,
};
module_platform_driver(rzg2l_thermal_driver);
--
2.39.0
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 (mostly) ignored
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.
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 5 ++---
drivers/thermal/intel/int340x_thermal/int3401_thermal.c | 6 ++----
drivers/thermal/intel/int340x_thermal/int3402_thermal.c | 6 ++----
drivers/thermal/intel/int340x_thermal/int3403_thermal.c | 6 ++----
drivers/thermal/intel/int340x_thermal/int3406_thermal.c | 5 ++---
5 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
index 5e1164226ada..8fbc97641740 100644
--- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
@@ -674,7 +674,7 @@ static int int3400_thermal_probe(struct platform_device *pdev)
return result;
}
-static int int3400_thermal_remove(struct platform_device *pdev)
+static void int3400_thermal_remove(struct platform_device *pdev)
{
struct int3400_thermal_priv *priv = platform_get_drvdata(pdev);
@@ -698,7 +698,6 @@ static int int3400_thermal_remove(struct platform_device *pdev)
kfree(priv->trts);
kfree(priv->arts);
kfree(priv);
- return 0;
}
static const struct acpi_device_id int3400_thermal_match[] = {
@@ -714,7 +713,7 @@ MODULE_DEVICE_TABLE(acpi, int3400_thermal_match);
static struct platform_driver int3400_thermal_driver = {
.probe = int3400_thermal_probe,
- .remove = int3400_thermal_remove,
+ .remove_new = int3400_thermal_remove,
.driver = {
.name = "int3400 thermal",
.acpi_match_table = ACPI_PTR(int3400_thermal_match),
diff --git a/drivers/thermal/intel/int340x_thermal/int3401_thermal.c b/drivers/thermal/intel/int340x_thermal/int3401_thermal.c
index 217786fba185..714f4cb59cfd 100644
--- a/drivers/thermal/intel/int340x_thermal/int3401_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3401_thermal.c
@@ -36,11 +36,9 @@ static int int3401_add(struct platform_device *pdev)
return ret;
}
-static int int3401_remove(struct platform_device *pdev)
+static void int3401_remove(struct platform_device *pdev)
{
proc_thermal_remove(platform_get_drvdata(pdev));
-
- return 0;
}
#ifdef CONFIG_PM_SLEEP
@@ -62,7 +60,7 @@ static SIMPLE_DEV_PM_OPS(int3401_proc_thermal_pm, int3401_thermal_suspend,
static struct platform_driver int3401_driver = {
.probe = int3401_add,
- .remove = int3401_remove,
+ .remove_new = int3401_remove,
.driver = {
.name = "int3401 thermal",
.acpi_match_table = int3401_device_ids,
diff --git a/drivers/thermal/intel/int340x_thermal/int3402_thermal.c b/drivers/thermal/intel/int340x_thermal/int3402_thermal.c
index 43fa351e2b9e..ab8bfb5a3946 100644
--- a/drivers/thermal/intel/int340x_thermal/int3402_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3402_thermal.c
@@ -71,15 +71,13 @@ static int int3402_thermal_probe(struct platform_device *pdev)
return 0;
}
-static int int3402_thermal_remove(struct platform_device *pdev)
+static void int3402_thermal_remove(struct platform_device *pdev)
{
struct int3402_thermal_data *d = platform_get_drvdata(pdev);
acpi_remove_notify_handler(d->handle,
ACPI_DEVICE_NOTIFY, int3402_notify);
int340x_thermal_zone_remove(d->int340x_zone);
-
- return 0;
}
static const struct acpi_device_id int3402_thermal_match[] = {
@@ -91,7 +89,7 @@ MODULE_DEVICE_TABLE(acpi, int3402_thermal_match);
static struct platform_driver int3402_thermal_driver = {
.probe = int3402_thermal_probe,
- .remove = int3402_thermal_remove,
+ .remove_new = int3402_thermal_remove,
.driver = {
.name = "int3402 thermal",
.acpi_match_table = int3402_thermal_match,
diff --git a/drivers/thermal/intel/int340x_thermal/int3403_thermal.c b/drivers/thermal/intel/int340x_thermal/int3403_thermal.c
index e418d270bc76..9b33fd3a66da 100644
--- a/drivers/thermal/intel/int340x_thermal/int3403_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3403_thermal.c
@@ -262,7 +262,7 @@ static int int3403_add(struct platform_device *pdev)
return result;
}
-static int int3403_remove(struct platform_device *pdev)
+static void int3403_remove(struct platform_device *pdev)
{
struct int3403_priv *priv = platform_get_drvdata(pdev);
@@ -277,8 +277,6 @@ static int int3403_remove(struct platform_device *pdev)
default:
break;
}
-
- return 0;
}
static const struct acpi_device_id int3403_device_ids[] = {
@@ -293,7 +291,7 @@ MODULE_DEVICE_TABLE(acpi, int3403_device_ids);
static struct platform_driver int3403_driver = {
.probe = int3403_add,
- .remove = int3403_remove,
+ .remove_new = int3403_remove,
.driver = {
.name = "int3403 thermal",
.acpi_match_table = int3403_device_ids,
diff --git a/drivers/thermal/intel/int340x_thermal/int3406_thermal.c b/drivers/thermal/intel/int340x_thermal/int3406_thermal.c
index f5e42fc2acc0..1c266493c1aa 100644
--- a/drivers/thermal/intel/int340x_thermal/int3406_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3406_thermal.c
@@ -178,13 +178,12 @@ static int int3406_thermal_probe(struct platform_device *pdev)
return -ENODEV;
}
-static int int3406_thermal_remove(struct platform_device *pdev)
+static void int3406_thermal_remove(struct platform_device *pdev)
{
struct int3406_thermal_data *d = platform_get_drvdata(pdev);
thermal_cooling_device_unregister(d->cooling_dev);
kfree(d->br);
- return 0;
}
static const struct acpi_device_id int3406_thermal_match[] = {
@@ -196,7 +195,7 @@ MODULE_DEVICE_TABLE(acpi, int3406_thermal_match);
static struct platform_driver int3406_thermal_driver = {
.probe = int3406_thermal_probe,
- .remove = int3406_thermal_remove,
+ .remove_new = int3406_thermal_remove,
.driver = {
.name = "int3406 thermal",
.acpi_match_table = int3406_thermal_match,
--
2.39.0
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 (mostly) ignored
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.
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/thermal/samsung/exynos_tmu.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index 45e5c840d130..576ad558cfb7 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -1124,7 +1124,7 @@ static int exynos_tmu_probe(struct platform_device *pdev)
return ret;
}
-static int exynos_tmu_remove(struct platform_device *pdev)
+static void exynos_tmu_remove(struct platform_device *pdev)
{
struct exynos_tmu_data *data = platform_get_drvdata(pdev);
@@ -1137,8 +1137,6 @@ static int exynos_tmu_remove(struct platform_device *pdev)
if (!IS_ERR(data->regulator))
regulator_disable(data->regulator);
-
- return 0;
}
#ifdef CONFIG_PM_SLEEP
@@ -1173,7 +1171,7 @@ static struct platform_driver exynos_tmu_driver = {
.of_match_table = exynos_tmu_match,
},
.probe = exynos_tmu_probe,
- .remove = exynos_tmu_remove,
+ .remove_new = exynos_tmu_remove,
};
module_platform_driver(exynos_tmu_driver);
--
2.39.0
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 (mostly) ignored
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.
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/thermal/st/stm_thermal.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c
index 903fcf1763f1..da6a25ce4469 100644
--- a/drivers/thermal/st/stm_thermal.c
+++ b/drivers/thermal/st/stm_thermal.c
@@ -571,14 +571,12 @@ static int stm_thermal_probe(struct platform_device *pdev)
return ret;
}
-static int stm_thermal_remove(struct platform_device *pdev)
+static void stm_thermal_remove(struct platform_device *pdev)
{
struct stm_thermal_sensor *sensor = platform_get_drvdata(pdev);
stm_thermal_sensor_off(sensor);
thermal_remove_hwmon_sysfs(sensor->th_dev);
-
- return 0;
}
static struct platform_driver stm_thermal_driver = {
@@ -588,7 +586,7 @@ static struct platform_driver stm_thermal_driver = {
.of_match_table = stm_thermal_of_match,
},
.probe = stm_thermal_probe,
- .remove = stm_thermal_remove,
+ .remove_new = stm_thermal_remove,
};
module_platform_driver(stm_thermal_driver);
--
2.39.0
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 (mostly) ignored
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.
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/thermal/k3_bandgap.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/thermal/k3_bandgap.c b/drivers/thermal/k3_bandgap.c
index 1c3e590157ec..ae03c5bdb5f1 100644
--- a/drivers/thermal/k3_bandgap.c
+++ b/drivers/thermal/k3_bandgap.c
@@ -236,12 +236,10 @@ static int k3_bandgap_probe(struct platform_device *pdev)
return ret;
}
-static int k3_bandgap_remove(struct platform_device *pdev)
+static void k3_bandgap_remove(struct platform_device *pdev)
{
pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev);
-
- return 0;
}
static const struct of_device_id of_k3_bandgap_match[] = {
@@ -254,7 +252,7 @@ MODULE_DEVICE_TABLE(of, of_k3_bandgap_match);
static struct platform_driver k3_bandgap_sensor_driver = {
.probe = k3_bandgap_probe,
- .remove = k3_bandgap_remove,
+ .remove_new = k3_bandgap_remove,
.driver = {
.name = "k3-soc-thermal",
.of_match_table = of_k3_bandgap_match,
--
2.39.0
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 (mostly) ignored
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.
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/thermal/rcar_thermal.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index b8571f7090aa..b4c58c5f6f6d 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -371,7 +371,7 @@ static irqreturn_t rcar_thermal_irq(int irq, void *data)
/*
* platform functions
*/
-static int rcar_thermal_remove(struct platform_device *pdev)
+static void rcar_thermal_remove(struct platform_device *pdev)
{
struct rcar_thermal_common *common = platform_get_drvdata(pdev);
struct device *dev = &pdev->dev;
@@ -388,8 +388,6 @@ static int rcar_thermal_remove(struct platform_device *pdev)
pm_runtime_put(dev);
pm_runtime_disable(dev);
-
- return 0;
}
static int rcar_thermal_probe(struct platform_device *pdev)
@@ -581,7 +579,7 @@ static struct platform_driver rcar_thermal_driver = {
.of_match_table = rcar_thermal_dt_ids,
},
.probe = rcar_thermal_probe,
- .remove = rcar_thermal_remove,
+ .remove_new = rcar_thermal_remove,
};
module_platform_driver(rcar_thermal_driver);
--
2.39.0
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 (mostly) ignored
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.
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/thermal/kirkwood_thermal.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c
index 668747bd86ef..94c95870f277 100644
--- a/drivers/thermal/kirkwood_thermal.c
+++ b/drivers/thermal/kirkwood_thermal.c
@@ -90,21 +90,19 @@ static int kirkwood_thermal_probe(struct platform_device *pdev)
return 0;
}
-static int kirkwood_thermal_exit(struct platform_device *pdev)
+static void kirkwood_thermal_exit(struct platform_device *pdev)
{
struct thermal_zone_device *kirkwood_thermal =
platform_get_drvdata(pdev);
thermal_zone_device_unregister(kirkwood_thermal);
-
- return 0;
}
MODULE_DEVICE_TABLE(of, kirkwood_thermal_id_table);
static struct platform_driver kirkwood_thermal_driver = {
.probe = kirkwood_thermal_probe,
- .remove = kirkwood_thermal_exit,
+ .remove_new = kirkwood_thermal_exit,
.driver = {
.name = "kirkwood_thermal",
.of_match_table = kirkwood_thermal_id_table,
--
2.39.0
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 (mostly) ignored
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.
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/thermal/ti-soc-thermal/ti-bandgap.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
index a1c9a1530183..6c23f2095631 100644
--- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c
+++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
@@ -1068,8 +1068,7 @@ int ti_bandgap_probe(struct platform_device *pdev)
return ret;
}
-static
-int ti_bandgap_remove(struct platform_device *pdev)
+static void ti_bandgap_remove(struct platform_device *pdev)
{
struct ti_bandgap *bgp = platform_get_drvdata(pdev);
int i;
@@ -1098,8 +1097,6 @@ int ti_bandgap_remove(struct platform_device *pdev)
if (TI_BANDGAP_HAS(bgp, TSHUT))
free_irq(gpiod_to_irq(bgp->tshut_gpiod), NULL);
-
- return 0;
}
#ifdef CONFIG_PM_SLEEP
@@ -1283,7 +1280,7 @@ MODULE_DEVICE_TABLE(of, of_ti_bandgap_match);
static struct platform_driver ti_bandgap_sensor_driver = {
.probe = ti_bandgap_probe,
- .remove = ti_bandgap_remove,
+ .remove_new = ti_bandgap_remove,
.driver = {
.name = "ti-soc-thermal",
.pm = DEV_PM_OPS,
--
2.39.0
On Wed, Jul 12, 2023 at 04:12:32PM +0800, Yangtao Li wrote:
> 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 (mostly) ignored
> 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.
>
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
>
> Cc: Uwe Kleine-K?nig <[email protected]>
> Signed-off-by: Yangtao Li <[email protected]>
> ---
> drivers/thermal/amlogic_thermal.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_thermal.c
> index 756b218880a7..a95c8959e5af 100644
> --- a/drivers/thermal/amlogic_thermal.c
> +++ b/drivers/thermal/amlogic_thermal.c
> @@ -293,11 +293,11 @@ static int amlogic_thermal_probe(struct platform_device *pdev)
> return ret;
> }
>
> -static int amlogic_thermal_remove(struct platform_device *pdev)
> +static void amlogic_thermal_remove(struct platform_device *pdev)
> {
> struct amlogic_thermal *data = platform_get_drvdata(pdev);
>
> - return amlogic_thermal_disable(data);
> + amlogic_thermal_disable(data);
I'd make amlogic_thermal_disable() return void, too.
Otherwise looks ok.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | https://www.pengutronix.de/ |
On Wed, Jul 12, 2023 at 10:23 AM Yangtao Li <[email protected]> wrote:
> 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 (mostly) ignored
> 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.
>
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
>
> Cc: Uwe Kleine-König <[email protected]>
> Signed-off-by: Yangtao Li <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Hello,
On Wed, Jul 12, 2023 at 04:12:52PM +0800, Yangtao Li wrote:
> 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 (mostly) ignored
> 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.
>
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
>
> Cc: Uwe Kleine-K?nig <[email protected]>
> Signed-off-by: Yangtao Li <[email protected]>
Reviewed-by: Uwe Kleine-K?nig <[email protected]>
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | https://www.pengutronix.de/ |
On 2023-07-12 16:12:52 +0800, Yangtao Li wrote:
> 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 (mostly) ignored
> 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.
>
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
>
> Cc: Uwe Kleine-König <[email protected]>
> Signed-off-by: Yangtao Li <[email protected]>
Reviewed-by: Niklas Söderlund <[email protected]>
> ---
> drivers/thermal/rcar_thermal.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
> index b8571f7090aa..b4c58c5f6f6d 100644
> --- a/drivers/thermal/rcar_thermal.c
> +++ b/drivers/thermal/rcar_thermal.c
> @@ -371,7 +371,7 @@ static irqreturn_t rcar_thermal_irq(int irq, void *data)
> /*
> * platform functions
> */
> -static int rcar_thermal_remove(struct platform_device *pdev)
> +static void rcar_thermal_remove(struct platform_device *pdev)
> {
> struct rcar_thermal_common *common = platform_get_drvdata(pdev);
> struct device *dev = &pdev->dev;
> @@ -388,8 +388,6 @@ static int rcar_thermal_remove(struct platform_device *pdev)
>
> pm_runtime_put(dev);
> pm_runtime_disable(dev);
> -
> - return 0;
> }
>
> static int rcar_thermal_probe(struct platform_device *pdev)
> @@ -581,7 +579,7 @@ static struct platform_driver rcar_thermal_driver = {
> .of_match_table = rcar_thermal_dt_ids,
> },
> .probe = rcar_thermal_probe,
> - .remove = rcar_thermal_remove,
> + .remove_new = rcar_thermal_remove,
> };
> module_platform_driver(rcar_thermal_driver);
>
> --
> 2.39.0
>
--
Kind Regards,
Niklas Söderlund
On Wed, Jul 12, 2023 at 10:14 AM Yangtao Li <[email protected]> wrote:
>
> 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 (mostly) ignored
> 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.
>
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
>
> Cc: Uwe Kleine-König <[email protected]>
> Signed-off-by: Yangtao Li <[email protected]>
Acked-by: Rafael J. Wysocki <[email protected]>
or please let me know if you want me to pick this up.
Thanks!
> ---
> drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 5 ++---
> drivers/thermal/intel/int340x_thermal/int3401_thermal.c | 6 ++----
> drivers/thermal/intel/int340x_thermal/int3402_thermal.c | 6 ++----
> drivers/thermal/intel/int340x_thermal/int3403_thermal.c | 6 ++----
> drivers/thermal/intel/int340x_thermal/int3406_thermal.c | 5 ++---
> 5 files changed, 10 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> index 5e1164226ada..8fbc97641740 100644
> --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> @@ -674,7 +674,7 @@ static int int3400_thermal_probe(struct platform_device *pdev)
> return result;
> }
>
> -static int int3400_thermal_remove(struct platform_device *pdev)
> +static void int3400_thermal_remove(struct platform_device *pdev)
> {
> struct int3400_thermal_priv *priv = platform_get_drvdata(pdev);
>
> @@ -698,7 +698,6 @@ static int int3400_thermal_remove(struct platform_device *pdev)
> kfree(priv->trts);
> kfree(priv->arts);
> kfree(priv);
> - return 0;
> }
>
> static const struct acpi_device_id int3400_thermal_match[] = {
> @@ -714,7 +713,7 @@ MODULE_DEVICE_TABLE(acpi, int3400_thermal_match);
>
> static struct platform_driver int3400_thermal_driver = {
> .probe = int3400_thermal_probe,
> - .remove = int3400_thermal_remove,
> + .remove_new = int3400_thermal_remove,
> .driver = {
> .name = "int3400 thermal",
> .acpi_match_table = ACPI_PTR(int3400_thermal_match),
> diff --git a/drivers/thermal/intel/int340x_thermal/int3401_thermal.c b/drivers/thermal/intel/int340x_thermal/int3401_thermal.c
> index 217786fba185..714f4cb59cfd 100644
> --- a/drivers/thermal/intel/int340x_thermal/int3401_thermal.c
> +++ b/drivers/thermal/intel/int340x_thermal/int3401_thermal.c
> @@ -36,11 +36,9 @@ static int int3401_add(struct platform_device *pdev)
> return ret;
> }
>
> -static int int3401_remove(struct platform_device *pdev)
> +static void int3401_remove(struct platform_device *pdev)
> {
> proc_thermal_remove(platform_get_drvdata(pdev));
> -
> - return 0;
> }
>
> #ifdef CONFIG_PM_SLEEP
> @@ -62,7 +60,7 @@ static SIMPLE_DEV_PM_OPS(int3401_proc_thermal_pm, int3401_thermal_suspend,
>
> static struct platform_driver int3401_driver = {
> .probe = int3401_add,
> - .remove = int3401_remove,
> + .remove_new = int3401_remove,
> .driver = {
> .name = "int3401 thermal",
> .acpi_match_table = int3401_device_ids,
> diff --git a/drivers/thermal/intel/int340x_thermal/int3402_thermal.c b/drivers/thermal/intel/int340x_thermal/int3402_thermal.c
> index 43fa351e2b9e..ab8bfb5a3946 100644
> --- a/drivers/thermal/intel/int340x_thermal/int3402_thermal.c
> +++ b/drivers/thermal/intel/int340x_thermal/int3402_thermal.c
> @@ -71,15 +71,13 @@ static int int3402_thermal_probe(struct platform_device *pdev)
> return 0;
> }
>
> -static int int3402_thermal_remove(struct platform_device *pdev)
> +static void int3402_thermal_remove(struct platform_device *pdev)
> {
> struct int3402_thermal_data *d = platform_get_drvdata(pdev);
>
> acpi_remove_notify_handler(d->handle,
> ACPI_DEVICE_NOTIFY, int3402_notify);
> int340x_thermal_zone_remove(d->int340x_zone);
> -
> - return 0;
> }
>
> static const struct acpi_device_id int3402_thermal_match[] = {
> @@ -91,7 +89,7 @@ MODULE_DEVICE_TABLE(acpi, int3402_thermal_match);
>
> static struct platform_driver int3402_thermal_driver = {
> .probe = int3402_thermal_probe,
> - .remove = int3402_thermal_remove,
> + .remove_new = int3402_thermal_remove,
> .driver = {
> .name = "int3402 thermal",
> .acpi_match_table = int3402_thermal_match,
> diff --git a/drivers/thermal/intel/int340x_thermal/int3403_thermal.c b/drivers/thermal/intel/int340x_thermal/int3403_thermal.c
> index e418d270bc76..9b33fd3a66da 100644
> --- a/drivers/thermal/intel/int340x_thermal/int3403_thermal.c
> +++ b/drivers/thermal/intel/int340x_thermal/int3403_thermal.c
> @@ -262,7 +262,7 @@ static int int3403_add(struct platform_device *pdev)
> return result;
> }
>
> -static int int3403_remove(struct platform_device *pdev)
> +static void int3403_remove(struct platform_device *pdev)
> {
> struct int3403_priv *priv = platform_get_drvdata(pdev);
>
> @@ -277,8 +277,6 @@ static int int3403_remove(struct platform_device *pdev)
> default:
> break;
> }
> -
> - return 0;
> }
>
> static const struct acpi_device_id int3403_device_ids[] = {
> @@ -293,7 +291,7 @@ MODULE_DEVICE_TABLE(acpi, int3403_device_ids);
>
> static struct platform_driver int3403_driver = {
> .probe = int3403_add,
> - .remove = int3403_remove,
> + .remove_new = int3403_remove,
> .driver = {
> .name = "int3403 thermal",
> .acpi_match_table = int3403_device_ids,
> diff --git a/drivers/thermal/intel/int340x_thermal/int3406_thermal.c b/drivers/thermal/intel/int340x_thermal/int3406_thermal.c
> index f5e42fc2acc0..1c266493c1aa 100644
> --- a/drivers/thermal/intel/int340x_thermal/int3406_thermal.c
> +++ b/drivers/thermal/intel/int340x_thermal/int3406_thermal.c
> @@ -178,13 +178,12 @@ static int int3406_thermal_probe(struct platform_device *pdev)
> return -ENODEV;
> }
>
> -static int int3406_thermal_remove(struct platform_device *pdev)
> +static void int3406_thermal_remove(struct platform_device *pdev)
> {
> struct int3406_thermal_data *d = platform_get_drvdata(pdev);
>
> thermal_cooling_device_unregister(d->cooling_dev);
> kfree(d->br);
> - return 0;
> }
>
> static const struct acpi_device_id int3406_thermal_match[] = {
> @@ -196,7 +195,7 @@ MODULE_DEVICE_TABLE(acpi, int3406_thermal_match);
>
> static struct platform_driver int3406_thermal_driver = {
> .probe = int3406_thermal_probe,
> - .remove = int3406_thermal_remove,
> + .remove_new = int3406_thermal_remove,
> .driver = {
> .name = "int3406 thermal",
> .acpi_match_table = int3406_thermal_match,
> --
> 2.39.0
>