Skip to content

Commit

Permalink
tpm/tpm_tis_synquacer: Convert to platform remove callback returning …
Browse files Browse the repository at this point in the history
…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 (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.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
  • Loading branch information
Uwe Kleine-König authored and Jarkko Sakkinen committed Apr 24, 2023
1 parent c3da2c6 commit 7b69ef6
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/char/tpm/tpm_tis_synquacer.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,12 @@ static int tpm_tis_synquacer_probe(struct platform_device *pdev)
return tpm_tis_synquacer_init(&pdev->dev, &tpm_info);
}

static int tpm_tis_synquacer_remove(struct platform_device *pdev)
static void tpm_tis_synquacer_remove(struct platform_device *pdev)
{
struct tpm_chip *chip = dev_get_drvdata(&pdev->dev);

tpm_chip_unregister(chip);
tpm_tis_remove(chip);

return 0;
}

#ifdef CONFIG_OF
Expand All @@ -155,7 +153,7 @@ MODULE_DEVICE_TABLE(acpi, tpm_synquacer_acpi_tbl);

static struct platform_driver tis_synquacer_drv = {
.probe = tpm_tis_synquacer_probe,
.remove = tpm_tis_synquacer_remove,
.remove_new = tpm_tis_synquacer_remove,
.driver = {
.name = "tpm_tis_synquacer",
.pm = &tpm_tis_synquacer_pm,
Expand Down

0 comments on commit 7b69ef6

Please sign in to comment.