aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/ds.c
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2008-04-28 15:15:04 -0400
committerIngo Molnar <mingo@elte.hu>2008-05-12 15:27:53 -0400
commit573da4224e8c3800e613d715e909c3179a7e3cb2 (patch)
tree10bfd45af955c2509926c63f2e91ff729bb9c12d /arch/x86/kernel/ds.c
parent970e725098a6da5a9c1f8128102c812e31a0444c (diff)
x86: DS cleanup - dont treat 0 as NULL
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/ds.c')
-rw-r--r--arch/x86/kernel/ds.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/arch/x86/kernel/ds.c b/arch/x86/kernel/ds.c
index 5b32b6d062b4..24a323c95997 100644
--- a/arch/x86/kernel/ds.c
+++ b/arch/x86/kernel/ds.c
@@ -238,12 +238,12 @@ static inline struct ds_context *ds_alloc_context(struct task_struct *task)
238 context = kzalloc(sizeof(*context), GFP_KERNEL); 238 context = kzalloc(sizeof(*context), GFP_KERNEL);
239 239
240 if (!context) 240 if (!context)
241 return 0; 241 return NULL;
242 242
243 context->ds = kzalloc(ds_cfg.sizeof_ds, GFP_KERNEL); 243 context->ds = kzalloc(ds_cfg.sizeof_ds, GFP_KERNEL);
244 if (!context->ds) { 244 if (!context->ds) {
245 kfree(context); 245 kfree(context);
246 return 0; 246 return NULL;
247 } 247 }
248 248
249 *p_context = context; 249 *p_context = context;
@@ -279,7 +279,7 @@ static inline void ds_put_context(struct ds_context *context)
279 if (--context->count) 279 if (--context->count)
280 goto out; 280 goto out;
281 281
282 *(context->this) = 0; 282 *(context->this) = NULL;
283 283
284 if (context->task) 284 if (context->task)
285 clear_tsk_thread_flag(context->task, TIF_DS_AREA_MSR); 285 clear_tsk_thread_flag(context->task, TIF_DS_AREA_MSR);
@@ -341,16 +341,16 @@ static inline void *ds_allocate_buffer(size_t size, unsigned int *pages)
341 rlim = current->signal->rlim[RLIMIT_AS].rlim_cur >> PAGE_SHIFT; 341 rlim = current->signal->rlim[RLIMIT_AS].rlim_cur >> PAGE_SHIFT;
342 vm = current->mm->total_vm + pgsz; 342 vm = current->mm->total_vm + pgsz;
343 if (rlim < vm) 343 if (rlim < vm)
344 return 0; 344 return NULL;
345 345
346 rlim = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur >> PAGE_SHIFT; 346 rlim = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur >> PAGE_SHIFT;
347 vm = current->mm->locked_vm + pgsz; 347 vm = current->mm->locked_vm + pgsz;
348 if (rlim < vm) 348 if (rlim < vm)
349 return 0; 349 return NULL;
350 350
351 buffer = kzalloc(size, GFP_KERNEL); 351 buffer = kzalloc(size, GFP_KERNEL);
352 if (!buffer) 352 if (!buffer)
353 return 0; 353 return NULL;
354 354
355 current->mm->total_vm += pgsz; 355 current->mm->total_vm += pgsz;
356 current->mm->locked_vm += pgsz; 356 current->mm->locked_vm += pgsz;
@@ -395,7 +395,7 @@ static int ds_request(struct task_struct *task, void *base, size_t size,
395 if (context->owner[qual] == current) 395 if (context->owner[qual] == current)
396 goto out_unlock; 396 goto out_unlock;
397 error = -EPERM; 397 error = -EPERM;
398 if (context->owner[qual] != 0) 398 if (context->owner[qual] != NULL)
399 goto out_unlock; 399 goto out_unlock;
400 context->owner[qual] = current; 400 context->owner[qual] = current;
401 401
@@ -445,7 +445,7 @@ static int ds_request(struct task_struct *task, void *base, size_t size,
445 return error; 445 return error;
446 446
447 out_release: 447 out_release:
448 context->owner[qual] = 0; 448 context->owner[qual] = NULL;
449 ds_put_context(context); 449 ds_put_context(context);
450 return error; 450 return error;
451 451
@@ -825,7 +825,7 @@ void __cpuinit ds_init_intel(struct cpuinfo_x86 *c)
825 ds_configure(&ds_cfg_var); 825 ds_configure(&ds_cfg_var);
826 break; 826 break;
827 case 0xF: /* Core2 */ 827 case 0xF: /* Core2 */
828 case 0x1C: /* Atom */ 828 case 0x1C: /* Atom */
829 ds_configure(&ds_cfg_64); 829 ds_configure(&ds_cfg_64);
830 break; 830 break;
831 default: 831 default: