Skip to content

Commit 8cd6d0a

Browse files
Uwe Kleine-Königmartinkpetersen
authored andcommitted
scsi: hisi_sas: Convert to platform remove callback returning 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. hisi_sas_remove() returned zero unconditionally so this was changed to return void. Then it has the right prototype to be used directly as remove callback for the two hisi_sas drivers. Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent a48e2c3 commit 8cd6d0a

File tree

4 files changed

+4
-15
lines changed

4 files changed

+4
-15
lines changed

drivers/scsi/hisi_sas/hisi_sas.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ extern void hisi_sas_sata_done(struct sas_task *task,
642642
extern int hisi_sas_get_fw_info(struct hisi_hba *hisi_hba);
643643
extern int hisi_sas_probe(struct platform_device *pdev,
644644
const struct hisi_sas_hw *ops);
645-
extern int hisi_sas_remove(struct platform_device *pdev);
645+
extern void hisi_sas_remove(struct platform_device *pdev);
646646

647647
extern int hisi_sas_slave_configure(struct scsi_device *sdev);
648648
extern int hisi_sas_slave_alloc(struct scsi_device *sdev);

drivers/scsi/hisi_sas/hisi_sas_main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2560,7 +2560,7 @@ int hisi_sas_probe(struct platform_device *pdev,
25602560
}
25612561
EXPORT_SYMBOL_GPL(hisi_sas_probe);
25622562

2563-
int hisi_sas_remove(struct platform_device *pdev)
2563+
void hisi_sas_remove(struct platform_device *pdev)
25642564
{
25652565
struct sas_ha_struct *sha = platform_get_drvdata(pdev);
25662566
struct hisi_hba *hisi_hba = sha->lldd_ha;
@@ -2573,7 +2573,6 @@ int hisi_sas_remove(struct platform_device *pdev)
25732573

25742574
hisi_sas_free(hisi_hba);
25752575
scsi_host_put(shost);
2576-
return 0;
25772576
}
25782577
EXPORT_SYMBOL_GPL(hisi_sas_remove);
25792578

drivers/scsi/hisi_sas/hisi_sas_v1_hw.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,11 +1790,6 @@ static int hisi_sas_v1_probe(struct platform_device *pdev)
17901790
return hisi_sas_probe(pdev, &hisi_sas_v1_hw);
17911791
}
17921792

1793-
static int hisi_sas_v1_remove(struct platform_device *pdev)
1794-
{
1795-
return hisi_sas_remove(pdev);
1796-
}
1797-
17981793
static const struct of_device_id sas_v1_of_match[] = {
17991794
{ .compatible = "hisilicon,hip05-sas-v1",},
18001795
{},
@@ -1810,7 +1805,7 @@ MODULE_DEVICE_TABLE(acpi, sas_v1_acpi_match);
18101805

18111806
static struct platform_driver hisi_sas_v1_driver = {
18121807
.probe = hisi_sas_v1_probe,
1813-
.remove = hisi_sas_v1_remove,
1808+
.remove_new = hisi_sas_remove,
18141809
.driver = {
18151810
.name = DRV_NAME,
18161811
.of_match_table = sas_v1_of_match,

drivers/scsi/hisi_sas/hisi_sas_v2_hw.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3619,11 +3619,6 @@ static int hisi_sas_v2_probe(struct platform_device *pdev)
36193619
return hisi_sas_probe(pdev, &hisi_sas_v2_hw);
36203620
}
36213621

3622-
static int hisi_sas_v2_remove(struct platform_device *pdev)
3623-
{
3624-
return hisi_sas_remove(pdev);
3625-
}
3626-
36273622
static const struct of_device_id sas_v2_of_match[] = {
36283623
{ .compatible = "hisilicon,hip06-sas-v2",},
36293624
{ .compatible = "hisilicon,hip07-sas-v2",},
@@ -3640,7 +3635,7 @@ MODULE_DEVICE_TABLE(acpi, sas_v2_acpi_match);
36403635

36413636
static struct platform_driver hisi_sas_v2_driver = {
36423637
.probe = hisi_sas_v2_probe,
3643-
.remove = hisi_sas_v2_remove,
3638+
.remove_new = hisi_sas_remove,
36443639
.driver = {
36453640
.name = DRV_NAME,
36463641
.of_match_table = sas_v2_of_match,

0 commit comments

Comments
 (0)