diff options
author | Jesper Juhl <jesper.juhl@gmail.com> | 2006-06-27 05:55:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-27 20:32:48 -0400 |
commit | 8f7607803717e9d045965b210cd16a25d80cd04b (patch) | |
tree | 1e8af970aa305be5e229a86b3ccc2525f3936d3b | |
parent | 9a66a53f558efc2619a438278d2919b3c9a7f673 (diff) |
[PATCH] Remove redundant NULL checks before [kv]free - in drivers/
Remove redundant NULL chck before kfree + tiny CodingStyle cleanup for
drivers/
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/char/agp/sgi-agp.c | 5 | ||||
-rw-r--r-- | drivers/char/hvcs.c | 11 | ||||
-rw-r--r-- | drivers/message/fusion/mptfc.c | 6 | ||||
-rw-r--r-- | drivers/message/fusion/mptsas.c | 3 | ||||
-rw-r--r-- | drivers/net/fs_enet/fs_enet-mii.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/ipw2200.c | 22 | ||||
-rw-r--r-- | drivers/scsi/libata-scsi.c | 4 | ||||
-rw-r--r-- | drivers/video/au1100fb.c | 3 |
8 files changed, 19 insertions, 38 deletions
diff --git a/drivers/char/agp/sgi-agp.c b/drivers/char/agp/sgi-agp.c index cfa7922cb431..d73be4c2db8a 100644 --- a/drivers/char/agp/sgi-agp.c +++ b/drivers/char/agp/sgi-agp.c | |||
@@ -329,9 +329,8 @@ static int __devinit agp_sgi_init(void) | |||
329 | 329 | ||
330 | static void __devexit agp_sgi_cleanup(void) | 330 | static void __devexit agp_sgi_cleanup(void) |
331 | { | 331 | { |
332 | if (sgi_tioca_agp_bridges) | 332 | kfree(sgi_tioca_agp_bridges); |
333 | kfree(sgi_tioca_agp_bridges); | 333 | sgi_tioca_agp_bridges = NULL; |
334 | sgi_tioca_agp_bridges=NULL; | ||
335 | } | 334 | } |
336 | 335 | ||
337 | module_init(agp_sgi_init); | 336 | module_init(agp_sgi_init); |
diff --git a/drivers/char/hvcs.c b/drivers/char/hvcs.c index 8d97b3911293..afa26b65dac3 100644 --- a/drivers/char/hvcs.c +++ b/drivers/char/hvcs.c | |||
@@ -1320,11 +1320,12 @@ static struct tty_operations hvcs_ops = { | |||
1320 | static int hvcs_alloc_index_list(int n) | 1320 | static int hvcs_alloc_index_list(int n) |
1321 | { | 1321 | { |
1322 | int i; | 1322 | int i; |
1323 | |||
1323 | hvcs_index_list = kmalloc(n * sizeof(hvcs_index_count),GFP_KERNEL); | 1324 | hvcs_index_list = kmalloc(n * sizeof(hvcs_index_count),GFP_KERNEL); |
1324 | if (!hvcs_index_list) | 1325 | if (!hvcs_index_list) |
1325 | return -ENOMEM; | 1326 | return -ENOMEM; |
1326 | hvcs_index_count = n; | 1327 | hvcs_index_count = n; |
1327 | for(i = 0; i < hvcs_index_count; i++) | 1328 | for (i = 0; i < hvcs_index_count; i++) |
1328 | hvcs_index_list[i] = -1; | 1329 | hvcs_index_list[i] = -1; |
1329 | return 0; | 1330 | return 0; |
1330 | } | 1331 | } |
@@ -1332,11 +1333,9 @@ static int hvcs_alloc_index_list(int n) | |||
1332 | static void hvcs_free_index_list(void) | 1333 | static void hvcs_free_index_list(void) |
1333 | { | 1334 | { |
1334 | /* Paranoia check to be thorough. */ | 1335 | /* Paranoia check to be thorough. */ |
1335 | if (hvcs_index_list) { | 1336 | kfree(hvcs_index_list); |
1336 | kfree(hvcs_index_list); | 1337 | hvcs_index_list = NULL; |
1337 | hvcs_index_list = NULL; | 1338 | hvcs_index_count = 0; |
1338 | hvcs_index_count = 0; | ||
1339 | } | ||
1340 | } | 1339 | } |
1341 | 1340 | ||
1342 | static int __init hvcs_module_init(void) | 1341 | static int __init hvcs_module_init(void) |
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c index 74714e5bcf03..3ff8378ea660 100644 --- a/drivers/message/fusion/mptfc.c +++ b/drivers/message/fusion/mptfc.c | |||
@@ -305,10 +305,8 @@ mptfc_GetFcDevPage0(MPT_ADAPTER *ioc, int ioc_port, | |||
305 | } | 305 | } |
306 | 306 | ||
307 | out: | 307 | out: |
308 | if (pp0_array) | 308 | kfree(pp0_array); |
309 | kfree(pp0_array); | 309 | kfree(p0_array); |
310 | if (p0_array) | ||
311 | kfree(p0_array); | ||
312 | return rc; | 310 | return rc; |
313 | } | 311 | } |
314 | 312 | ||
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index af6ec553ff7c..85689ab46cbc 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c | |||
@@ -1378,8 +1378,7 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc) | |||
1378 | return 0; | 1378 | return 0; |
1379 | 1379 | ||
1380 | out_free_port_info: | 1380 | out_free_port_info: |
1381 | if (hba) | 1381 | kfree(hba); |
1382 | kfree(hba); | ||
1383 | out: | 1382 | out: |
1384 | return error; | 1383 | return error; |
1385 | } | 1384 | } |
diff --git a/drivers/net/fs_enet/fs_enet-mii.c b/drivers/net/fs_enet/fs_enet-mii.c index c6770377ef87..0cd07150bf4a 100644 --- a/drivers/net/fs_enet/fs_enet-mii.c +++ b/drivers/net/fs_enet/fs_enet-mii.c | |||
@@ -431,8 +431,7 @@ static struct fs_enet_mii_bus *create_bus(const struct fs_mii_bus_info *bi) | |||
431 | return bus; | 431 | return bus; |
432 | 432 | ||
433 | err: | 433 | err: |
434 | if (bus) | 434 | kfree(bus); |
435 | kfree(bus); | ||
436 | return ERR_PTR(ret); | 435 | return ERR_PTR(ret); |
437 | } | 436 | } |
438 | 437 | ||
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 081a8999666e..a8a8f975432f 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -1229,12 +1229,6 @@ static struct ipw_fw_error *ipw_alloc_error_log(struct ipw_priv *priv) | |||
1229 | return error; | 1229 | return error; |
1230 | } | 1230 | } |
1231 | 1231 | ||
1232 | static void ipw_free_error_log(struct ipw_fw_error *error) | ||
1233 | { | ||
1234 | if (error) | ||
1235 | kfree(error); | ||
1236 | } | ||
1237 | |||
1238 | static ssize_t show_event_log(struct device *d, | 1232 | static ssize_t show_event_log(struct device *d, |
1239 | struct device_attribute *attr, char *buf) | 1233 | struct device_attribute *attr, char *buf) |
1240 | { | 1234 | { |
@@ -1296,10 +1290,9 @@ static ssize_t clear_error(struct device *d, | |||
1296 | const char *buf, size_t count) | 1290 | const char *buf, size_t count) |
1297 | { | 1291 | { |
1298 | struct ipw_priv *priv = dev_get_drvdata(d); | 1292 | struct ipw_priv *priv = dev_get_drvdata(d); |
1299 | if (priv->error) { | 1293 | |
1300 | ipw_free_error_log(priv->error); | 1294 | kfree(priv->error); |
1301 | priv->error = NULL; | 1295 | priv->error = NULL; |
1302 | } | ||
1303 | return count; | 1296 | return count; |
1304 | } | 1297 | } |
1305 | 1298 | ||
@@ -1970,8 +1963,7 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) | |||
1970 | struct ipw_fw_error *error = | 1963 | struct ipw_fw_error *error = |
1971 | ipw_alloc_error_log(priv); | 1964 | ipw_alloc_error_log(priv); |
1972 | ipw_dump_error_log(priv, error); | 1965 | ipw_dump_error_log(priv, error); |
1973 | if (error) | 1966 | kfree(error); |
1974 | ipw_free_error_log(error); | ||
1975 | } | 1967 | } |
1976 | #endif | 1968 | #endif |
1977 | } else { | 1969 | } else { |
@@ -11693,10 +11685,8 @@ static void ipw_pci_remove(struct pci_dev *pdev) | |||
11693 | } | 11685 | } |
11694 | } | 11686 | } |
11695 | 11687 | ||
11696 | if (priv->error) { | 11688 | kfree(priv->error); |
11697 | ipw_free_error_log(priv->error); | 11689 | priv->error = NULL; |
11698 | priv->error = NULL; | ||
11699 | } | ||
11700 | 11690 | ||
11701 | #ifdef CONFIG_IPW2200_PROMISCUOUS | 11691 | #ifdef CONFIG_IPW2200_PROMISCUOUS |
11702 | ipw_prom_free(priv); | 11692 | ipw_prom_free(priv); |
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 93d18a74c401..2915bca691e8 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -222,9 +222,7 @@ int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg) | |||
222 | && copy_to_user(arg + sizeof(args), argbuf, argsize)) | 222 | && copy_to_user(arg + sizeof(args), argbuf, argsize)) |
223 | rc = -EFAULT; | 223 | rc = -EFAULT; |
224 | error: | 224 | error: |
225 | if (argbuf) | 225 | kfree(argbuf); |
226 | kfree(argbuf); | ||
227 | |||
228 | return rc; | 226 | return rc; |
229 | } | 227 | } |
230 | 228 | ||
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c index d63c3f485853..9ef68cd83bb4 100644 --- a/drivers/video/au1100fb.c +++ b/drivers/video/au1100fb.c | |||
@@ -743,8 +743,7 @@ void __exit au1100fb_cleanup(void) | |||
743 | { | 743 | { |
744 | driver_unregister(&au1100fb_driver); | 744 | driver_unregister(&au1100fb_driver); |
745 | 745 | ||
746 | if (drv_info.opt_mode) | 746 | kfree(drv_info.opt_mode); |
747 | kfree(drv_info.opt_mode); | ||
748 | } | 747 | } |
749 | 748 | ||
750 | module_init(au1100fb_init); | 749 | module_init(au1100fb_init); |