diff options
Diffstat (limited to 'drivers/mtd/devices/ms02-nv.c')
-rw-r--r-- | drivers/mtd/devices/ms02-nv.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/mtd/devices/ms02-nv.c b/drivers/mtd/devices/ms02-nv.c index 08dfb899b272..9cff119a2024 100644 --- a/drivers/mtd/devices/ms02-nv.c +++ b/drivers/mtd/devices/ms02-nv.c | |||
@@ -131,11 +131,10 @@ static int __init ms02nv_init_one(ulong addr) | |||
131 | int ret = -ENODEV; | 131 | int ret = -ENODEV; |
132 | 132 | ||
133 | /* The module decodes 8MiB of address space. */ | 133 | /* The module decodes 8MiB of address space. */ |
134 | mod_res = kmalloc(sizeof(*mod_res), GFP_KERNEL); | 134 | mod_res = kzalloc(sizeof(*mod_res), GFP_KERNEL); |
135 | if (!mod_res) | 135 | if (!mod_res) |
136 | return -ENOMEM; | 136 | return -ENOMEM; |
137 | 137 | ||
138 | memset(mod_res, 0, sizeof(*mod_res)); | ||
139 | mod_res->name = ms02nv_name; | 138 | mod_res->name = ms02nv_name; |
140 | mod_res->start = addr; | 139 | mod_res->start = addr; |
141 | mod_res->end = addr + MS02NV_SLOT_SIZE - 1; | 140 | mod_res->end = addr + MS02NV_SLOT_SIZE - 1; |
@@ -153,24 +152,21 @@ static int __init ms02nv_init_one(ulong addr) | |||
153 | } | 152 | } |
154 | 153 | ||
155 | ret = -ENOMEM; | 154 | ret = -ENOMEM; |
156 | mtd = kmalloc(sizeof(*mtd), GFP_KERNEL); | 155 | mtd = kzalloc(sizeof(*mtd), GFP_KERNEL); |
157 | if (!mtd) | 156 | if (!mtd) |
158 | goto err_out_mod_res_rel; | 157 | goto err_out_mod_res_rel; |
159 | memset(mtd, 0, sizeof(*mtd)); | 158 | mp = kzalloc(sizeof(*mp), GFP_KERNEL); |
160 | mp = kmalloc(sizeof(*mp), GFP_KERNEL); | ||
161 | if (!mp) | 159 | if (!mp) |
162 | goto err_out_mtd; | 160 | goto err_out_mtd; |
163 | memset(mp, 0, sizeof(*mp)); | ||
164 | 161 | ||
165 | mtd->priv = mp; | 162 | mtd->priv = mp; |
166 | mp->resource.module = mod_res; | 163 | mp->resource.module = mod_res; |
167 | 164 | ||
168 | /* Firmware's diagnostic NVRAM area. */ | 165 | /* Firmware's diagnostic NVRAM area. */ |
169 | diag_res = kmalloc(sizeof(*diag_res), GFP_KERNEL); | 166 | diag_res = kzalloc(sizeof(*diag_res), GFP_KERNEL); |
170 | if (!diag_res) | 167 | if (!diag_res) |
171 | goto err_out_mp; | 168 | goto err_out_mp; |
172 | 169 | ||
173 | memset(diag_res, 0, sizeof(*diag_res)); | ||
174 | diag_res->name = ms02nv_res_diag_ram; | 170 | diag_res->name = ms02nv_res_diag_ram; |
175 | diag_res->start = addr; | 171 | diag_res->start = addr; |
176 | diag_res->end = addr + MS02NV_RAM - 1; | 172 | diag_res->end = addr + MS02NV_RAM - 1; |
@@ -180,11 +176,10 @@ static int __init ms02nv_init_one(ulong addr) | |||
180 | mp->resource.diag_ram = diag_res; | 176 | mp->resource.diag_ram = diag_res; |
181 | 177 | ||
182 | /* User-available general-purpose NVRAM area. */ | 178 | /* User-available general-purpose NVRAM area. */ |
183 | user_res = kmalloc(sizeof(*user_res), GFP_KERNEL); | 179 | user_res = kzalloc(sizeof(*user_res), GFP_KERNEL); |
184 | if (!user_res) | 180 | if (!user_res) |
185 | goto err_out_diag_res; | 181 | goto err_out_diag_res; |
186 | 182 | ||
187 | memset(user_res, 0, sizeof(*user_res)); | ||
188 | user_res->name = ms02nv_res_user_ram; | 183 | user_res->name = ms02nv_res_user_ram; |
189 | user_res->start = addr + MS02NV_RAM; | 184 | user_res->start = addr + MS02NV_RAM; |
190 | user_res->end = addr + size - 1; | 185 | user_res->end = addr + size - 1; |
@@ -194,11 +189,10 @@ static int __init ms02nv_init_one(ulong addr) | |||
194 | mp->resource.user_ram = user_res; | 189 | mp->resource.user_ram = user_res; |
195 | 190 | ||
196 | /* Control and status register. */ | 191 | /* Control and status register. */ |
197 | csr_res = kmalloc(sizeof(*csr_res), GFP_KERNEL); | 192 | csr_res = kzalloc(sizeof(*csr_res), GFP_KERNEL); |
198 | if (!csr_res) | 193 | if (!csr_res) |
199 | goto err_out_user_res; | 194 | goto err_out_user_res; |
200 | 195 | ||
201 | memset(csr_res, 0, sizeof(*csr_res)); | ||
202 | csr_res->name = ms02nv_res_csr; | 196 | csr_res->name = ms02nv_res_csr; |
203 | csr_res->start = addr + MS02NV_CSR; | 197 | csr_res->start = addr + MS02NV_CSR; |
204 | csr_res->end = addr + MS02NV_CSR + 3; | 198 | csr_res->end = addr + MS02NV_CSR + 3; |