Skip to content

Commit 8f4e45a

Browse files
Uwe Kleine-Königdavem330
authored andcommitted
net: ethernet: sun: 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 ignored (apart from emitting a warning) 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. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert these drivers 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> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d3cd324 commit 8f4e45a

3 files changed

Lines changed: 6 additions & 11 deletions

File tree

drivers/net/ethernet/sun/niu.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10132,7 +10132,7 @@ static int niu_of_probe(struct platform_device *op)
1013210132
return err;
1013310133
}
1013410134

10135-
static int niu_of_remove(struct platform_device *op)
10135+
static void niu_of_remove(struct platform_device *op)
1013610136
{
1013710137
struct net_device *dev = platform_get_drvdata(op);
1013810138

@@ -10165,7 +10165,6 @@ static int niu_of_remove(struct platform_device *op)
1016510165

1016610166
free_netdev(dev);
1016710167
}
10168-
return 0;
1016910168
}
1017010169

1017110170
static const struct of_device_id niu_match[] = {
@@ -10183,7 +10182,7 @@ static struct platform_driver niu_of_driver = {
1018310182
.of_match_table = niu_match,
1018410183
},
1018510184
.probe = niu_of_probe,
10186-
.remove = niu_of_remove,
10185+
.remove_new = niu_of_remove,
1018710186
};
1018810187

1018910188
#endif /* CONFIG_SPARC64 */

drivers/net/ethernet/sun/sunbmac.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,7 @@ static int bigmac_sbus_probe(struct platform_device *op)
12341234
return bigmac_ether_init(op, qec_op);
12351235
}
12361236

1237-
static int bigmac_sbus_remove(struct platform_device *op)
1237+
static void bigmac_sbus_remove(struct platform_device *op)
12381238
{
12391239
struct bigmac *bp = platform_get_drvdata(op);
12401240
struct device *parent = op->dev.parent;
@@ -1255,8 +1255,6 @@ static int bigmac_sbus_remove(struct platform_device *op)
12551255
bp->bblock_dvma);
12561256

12571257
free_netdev(net_dev);
1258-
1259-
return 0;
12601258
}
12611259

12621260
static const struct of_device_id bigmac_sbus_match[] = {
@@ -1274,7 +1272,7 @@ static struct platform_driver bigmac_sbus_driver = {
12741272
.of_match_table = bigmac_sbus_match,
12751273
},
12761274
.probe = bigmac_sbus_probe,
1277-
.remove = bigmac_sbus_remove,
1275+
.remove_new = bigmac_sbus_remove,
12781276
};
12791277

12801278
module_platform_driver(bigmac_sbus_driver);

drivers/net/ethernet/sun/sunqe.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ static int qec_sbus_probe(struct platform_device *op)
933933
return qec_ether_init(op);
934934
}
935935

936-
static int qec_sbus_remove(struct platform_device *op)
936+
static void qec_sbus_remove(struct platform_device *op)
937937
{
938938
struct sunqe *qp = platform_get_drvdata(op);
939939
struct net_device *net_dev = qp->dev;
@@ -948,8 +948,6 @@ static int qec_sbus_remove(struct platform_device *op)
948948
qp->buffers, qp->buffers_dvma);
949949

950950
free_netdev(net_dev);
951-
952-
return 0;
953951
}
954952

955953
static const struct of_device_id qec_sbus_match[] = {
@@ -967,7 +965,7 @@ static struct platform_driver qec_sbus_driver = {
967965
.of_match_table = qec_sbus_match,
968966
},
969967
.probe = qec_sbus_probe,
970-
.remove = qec_sbus_remove,
968+
.remove_new = qec_sbus_remove,
971969
};
972970

973971
static int __init qec_init(void)

0 commit comments

Comments
 (0)