Skip to content

Commit 1ec33e2

Browse files
Uwe Kleine-Königvinodkoul
authored andcommitted
soundwire: amd: Improve error message in remove callback
Returning an error code in the remove callback yields to an error message remove callback returned a non-zero value. This will be ignored. After that the device is removed anyhow. Improve the error message to at least say what the actual problem is. While touching that code, convert the driver to the .remove_new() callback which returns no value with the same effect as returning zero in a .remove() callback. As the return value is ignored by the core the only effect of this patch is to improve the error message. (And the motivating effect is that there is one less driver using .remove().) Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230518200823.249795-1-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 217f5e0 commit 1ec33e2

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

drivers/soundwire/amd_manager.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -972,15 +972,18 @@ static int amd_sdw_manager_probe(struct platform_device *pdev)
972972
return 0;
973973
}
974974

975-
static int amd_sdw_manager_remove(struct platform_device *pdev)
975+
static void amd_sdw_manager_remove(struct platform_device *pdev)
976976
{
977977
struct amd_sdw_manager *amd_manager = dev_get_drvdata(&pdev->dev);
978+
int ret;
978979

979980
pm_runtime_disable(&pdev->dev);
980981
cancel_work_sync(&amd_manager->probe_work);
981982
amd_disable_sdw_interrupts(amd_manager);
982983
sdw_bus_master_delete(&amd_manager->bus);
983-
return amd_disable_sdw_manager(amd_manager);
984+
ret = amd_disable_sdw_manager(amd_manager);
985+
if (ret)
986+
dev_err(&pdev->dev, "Failed to disable device (%pe)\n", ERR_PTR(ret));
984987
}
985988

986989
static int amd_sdw_clock_stop(struct amd_sdw_manager *amd_manager)
@@ -1194,7 +1197,7 @@ static const struct dev_pm_ops amd_pm = {
11941197

11951198
static struct platform_driver amd_sdw_driver = {
11961199
.probe = &amd_sdw_manager_probe,
1197-
.remove = &amd_sdw_manager_remove,
1200+
.remove_new = &amd_sdw_manager_remove,
11981201
.driver = {
11991202
.name = "amd_sdw_manager",
12001203
.pm = &amd_pm,

0 commit comments

Comments
 (0)