rev |
line source |
igor@333
|
1
|
igor@333
|
2 From: Jesper Juhl <jesper.juhl@gmail.com>
|
igor@333
|
3
|
igor@333
|
4 Remove redundant NULL chck before kfree + tiny CodingStyle cleanup for
|
igor@333
|
5 drivers/
|
igor@333
|
6
|
igor@333
|
7 Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
|
igor@333
|
8 Signed-off-by: Andrew Morton <akpm@osdl.org>
|
igor@333
|
9 ---
|
igor@333
|
10
|
igor@333
|
11 drivers/char/agp/sgi-agp.c | 5 ++---
|
igor@333
|
12 drivers/char/hvcs.c | 11 +++++------
|
igor@333
|
13 drivers/message/fusion/mptfc.c | 6 ++----
|
igor@333
|
14 drivers/message/fusion/mptsas.c | 3 +--
|
igor@333
|
15 drivers/net/fs_enet/fs_enet-mii.c | 3 +--
|
igor@333
|
16 drivers/net/wireless/ipw2200.c | 22 ++++++----------------
|
igor@333
|
17 drivers/scsi/libata-scsi.c | 4 +---
|
igor@333
|
18 drivers/video/au1100fb.c | 3 +--
|
igor@333
|
19 8 files changed, 19 insertions(+), 38 deletions(-)
|
igor@333
|
20
|
igor@333
|
21 diff -puN drivers/char/agp/sgi-agp.c~remove-redundant-null-checks-before-free-in-drivers drivers/char/agp/sgi-agp.c
|
igor@333
|
22 --- a/drivers/char/agp/sgi-agp.c~remove-redundant-null-checks-before-free-in-drivers
|
igor@333
|
23 +++ a/drivers/char/agp/sgi-agp.c
|
igor@333
|
24 @@ -329,9 +329,8 @@ static int __devinit agp_sgi_init(void)
|
igor@333
|
25
|
igor@333
|
26 static void __devexit agp_sgi_cleanup(void)
|
igor@333
|
27 {
|
igor@333
|
28 - if (sgi_tioca_agp_bridges)
|
igor@333
|
29 - kfree(sgi_tioca_agp_bridges);
|
igor@333
|
30 - sgi_tioca_agp_bridges=NULL;
|
igor@333
|
31 + kfree(sgi_tioca_agp_bridges);
|
igor@333
|
32 + sgi_tioca_agp_bridges = NULL;
|
igor@333
|
33 }
|
igor@333
|
34
|
igor@333
|
35 module_init(agp_sgi_init);
|
igor@333
|
36 diff -puN drivers/char/hvcs.c~remove-redundant-null-checks-before-free-in-drivers drivers/char/hvcs.c
|
igor@333
|
37 --- a/drivers/char/hvcs.c~remove-redundant-null-checks-before-free-in-drivers
|
igor@333
|
38 +++ a/drivers/char/hvcs.c
|
igor@333
|
39 @@ -1320,11 +1320,12 @@ static struct tty_operations hvcs_ops =
|
igor@333
|
40 static int hvcs_alloc_index_list(int n)
|
igor@333
|
41 {
|
igor@333
|
42 int i;
|
igor@333
|
43 +
|
igor@333
|
44 hvcs_index_list = kmalloc(n * sizeof(hvcs_index_count),GFP_KERNEL);
|
igor@333
|
45 if (!hvcs_index_list)
|
igor@333
|
46 return -ENOMEM;
|
igor@333
|
47 hvcs_index_count = n;
|
igor@333
|
48 - for(i = 0; i < hvcs_index_count; i++)
|
igor@333
|
49 + for (i = 0; i < hvcs_index_count; i++)
|
igor@333
|
50 hvcs_index_list[i] = -1;
|
igor@333
|
51 return 0;
|
igor@333
|
52 }
|
igor@333
|
53 @@ -1332,11 +1333,9 @@ static int hvcs_alloc_index_list(int n)
|
igor@333
|
54 static void hvcs_free_index_list(void)
|
igor@333
|
55 {
|
igor@333
|
56 /* Paranoia check to be thorough. */
|
igor@333
|
57 - if (hvcs_index_list) {
|
igor@333
|
58 - kfree(hvcs_index_list);
|
igor@333
|
59 - hvcs_index_list = NULL;
|
igor@333
|
60 - hvcs_index_count = 0;
|
igor@333
|
61 - }
|
igor@333
|
62 + kfree(hvcs_index_list);
|
igor@333
|
63 + hvcs_index_list = NULL;
|
igor@333
|
64 + hvcs_index_count = 0;
|
igor@333
|
65 }
|
igor@333
|
66
|
igor@333
|
67 static int __init hvcs_module_init(void)
|
igor@333
|
68 diff -puN drivers/message/fusion/mptfc.c~remove-redundant-null-checks-before-free-in-drivers drivers/message/fusion/mptfc.c
|
igor@333
|
69 --- a/drivers/message/fusion/mptfc.c~remove-redundant-null-checks-before-free-in-drivers
|
igor@333
|
70 +++ a/drivers/message/fusion/mptfc.c
|
igor@333
|
71 @@ -305,10 +305,8 @@ mptfc_GetFcDevPage0(MPT_ADAPTER *ioc, in
|
igor@333
|
72 }
|
igor@333
|
73
|
igor@333
|
74 out:
|
igor@333
|
75 - if (pp0_array)
|
igor@333
|
76 - kfree(pp0_array);
|
igor@333
|
77 - if (p0_array)
|
igor@333
|
78 - kfree(p0_array);
|
igor@333
|
79 + kfree(pp0_array);
|
igor@333
|
80 + kfree(p0_array);
|
igor@333
|
81 return rc;
|
igor@333
|
82 }
|
igor@333
|
83
|
igor@333
|
84 diff -puN drivers/message/fusion/mptsas.c~remove-redundant-null-checks-before-free-in-drivers drivers/message/fusion/mptsas.c
|
igor@333
|
85 --- a/drivers/message/fusion/mptsas.c~remove-redundant-null-checks-before-free-in-drivers
|
igor@333
|
86 +++ a/drivers/message/fusion/mptsas.c
|
igor@333
|
87 @@ -1378,8 +1378,7 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc)
|
igor@333
|
88 return 0;
|
igor@333
|
89
|
igor@333
|
90 out_free_port_info:
|
igor@333
|
91 - if (hba)
|
igor@333
|
92 - kfree(hba);
|
igor@333
|
93 + kfree(hba);
|
igor@333
|
94 out:
|
igor@333
|
95 return error;
|
igor@333
|
96 }
|
igor@333
|
97 diff -puN drivers/net/fs_enet/fs_enet-mii.c~remove-redundant-null-checks-before-free-in-drivers drivers/net/fs_enet/fs_enet-mii.c
|
igor@333
|
98 --- a/drivers/net/fs_enet/fs_enet-mii.c~remove-redundant-null-checks-before-free-in-drivers
|
igor@333
|
99 +++ a/drivers/net/fs_enet/fs_enet-mii.c
|
igor@333
|
100 @@ -431,8 +431,7 @@ static struct fs_enet_mii_bus *create_bu
|
igor@333
|
101 return bus;
|
igor@333
|
102
|
igor@333
|
103 err:
|
igor@333
|
104 - if (bus)
|
igor@333
|
105 - kfree(bus);
|
igor@333
|
106 + kfree(bus);
|
igor@333
|
107 return ERR_PTR(ret);
|
igor@333
|
108 }
|
igor@333
|
109
|
igor@333
|
110 diff -puN drivers/net/wireless/ipw2200.c~remove-redundant-null-checks-before-free-in-drivers drivers/net/wireless/ipw2200.c
|
igor@333
|
111 --- a/drivers/net/wireless/ipw2200.c~remove-redundant-null-checks-before-free-in-drivers
|
igor@333
|
112 +++ a/drivers/net/wireless/ipw2200.c
|
igor@333
|
113 @@ -1229,12 +1229,6 @@ static struct ipw_fw_error *ipw_alloc_er
|
igor@333
|
114 return error;
|
igor@333
|
115 }
|
igor@333
|
116
|
igor@333
|
117 -static void ipw_free_error_log(struct ipw_fw_error *error)
|
igor@333
|
118 -{
|
igor@333
|
119 - if (error)
|
igor@333
|
120 - kfree(error);
|
igor@333
|
121 -}
|
igor@333
|
122 -
|
igor@333
|
123 static ssize_t show_event_log(struct device *d,
|
igor@333
|
124 struct device_attribute *attr, char *buf)
|
igor@333
|
125 {
|
igor@333
|
126 @@ -1296,10 +1290,9 @@ static ssize_t clear_error(struct device
|
igor@333
|
127 const char *buf, size_t count)
|
igor@333
|
128 {
|
igor@333
|
129 struct ipw_priv *priv = dev_get_drvdata(d);
|
igor@333
|
130 - if (priv->error) {
|
igor@333
|
131 - ipw_free_error_log(priv->error);
|
igor@333
|
132 - priv->error = NULL;
|
igor@333
|
133 - }
|
igor@333
|
134 +
|
igor@333
|
135 + kfree(priv->error);
|
igor@333
|
136 + priv->error = NULL;
|
igor@333
|
137 return count;
|
igor@333
|
138 }
|
igor@333
|
139
|
igor@333
|
140 @@ -1970,8 +1963,7 @@ static void ipw_irq_tasklet(struct ipw_p
|
igor@333
|
141 struct ipw_fw_error *error =
|
igor@333
|
142 ipw_alloc_error_log(priv);
|
igor@333
|
143 ipw_dump_error_log(priv, error);
|
igor@333
|
144 - if (error)
|
igor@333
|
145 - ipw_free_error_log(error);
|
igor@333
|
146 + kfree(error);
|
igor@333
|
147 }
|
igor@333
|
148 #endif
|
igor@333
|
149 } else {
|
igor@333
|
150 @@ -11693,10 +11685,8 @@ static void ipw_pci_remove(struct pci_de
|
igor@333
|
151 }
|
igor@333
|
152 }
|
igor@333
|
153
|
igor@333
|
154 - if (priv->error) {
|
igor@333
|
155 - ipw_free_error_log(priv->error);
|
igor@333
|
156 - priv->error = NULL;
|
igor@333
|
157 - }
|
igor@333
|
158 + kfree(priv->error);
|
igor@333
|
159 + priv->error = NULL;
|
igor@333
|
160
|
igor@333
|
161 #ifdef CONFIG_IPW2200_PROMISCUOUS
|
igor@333
|
162 ipw_prom_free(priv);
|
igor@333
|
163 diff -puN drivers/scsi/libata-scsi.c~remove-redundant-null-checks-before-free-in-drivers drivers/scsi/libata-scsi.c
|
igor@333
|
164 --- a/drivers/scsi/libata-scsi.c~remove-redundant-null-checks-before-free-in-drivers
|
igor@333
|
165 +++ a/drivers/scsi/libata-scsi.c
|
igor@333
|
166 @@ -222,9 +222,7 @@ int ata_cmd_ioctl(struct scsi_device *sc
|
igor@333
|
167 && copy_to_user(arg + sizeof(args), argbuf, argsize))
|
igor@333
|
168 rc = -EFAULT;
|
igor@333
|
169 error:
|
igor@333
|
170 - if (argbuf)
|
igor@333
|
171 - kfree(argbuf);
|
igor@333
|
172 -
|
igor@333
|
173 + kfree(argbuf);
|
igor@333
|
174 return rc;
|
igor@333
|
175 }
|
igor@333
|
176
|
igor@333
|
177 diff -puN drivers/video/au1100fb.c~remove-redundant-null-checks-before-free-in-drivers drivers/video/au1100fb.c
|
igor@333
|
178 --- a/drivers/video/au1100fb.c~remove-redundant-null-checks-before-free-in-drivers
|
igor@333
|
179 +++ a/drivers/video/au1100fb.c
|
igor@333
|
180 @@ -743,8 +743,7 @@ void __exit au1100fb_cleanup(void)
|
igor@333
|
181 {
|
igor@333
|
182 driver_unregister(&au1100fb_driver);
|
igor@333
|
183
|
igor@333
|
184 - if (drv_info.opt_mode)
|
igor@333
|
185 - kfree(drv_info.opt_mode);
|
igor@333
|
186 + kfree(drv_info.opt_mode);
|
igor@333
|
187 }
|
igor@333
|
188
|
igor@333
|
189 module_init(au1100fb_init);
|
igor@333
|
190 _
|