mirror of
https://github.com/torvalds/linux.git
synced 2024-11-28 23:21:31 +00:00
ASoC: amd: acp: Fix error handling in .remove()
Even in the presence of problems (here: rn_acp_deinit() might fail), it's important to unregister all resources acquired during .probe() because even if .remove() returns an error code, the device is removed. As .remove() is only called after .probe() returned success, platdata must be valid, so the first check in .remove() can just be dropped. This is a preparation for making platform remove callbacks return void. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20220622061739.225966-1-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
1892a99188
commit
0deb003933
@ -307,16 +307,10 @@ static int renoir_audio_remove(struct platform_device *pdev)
|
||||
int ret;
|
||||
|
||||
chip = dev_get_platdata(&pdev->dev);
|
||||
if (!chip || !chip->base) {
|
||||
dev_err(&pdev->dev, "ACP chip data is NULL\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = rn_acp_deinit(chip->base);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "ACP de-init Failed\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (ret)
|
||||
dev_err(&pdev->dev, "ACP de-init Failed (%pe)\n", ERR_PTR(ret));
|
||||
|
||||
acp_platform_unregister(dev);
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user