diff options
author | Julia Lawall <julia@diku.dk> | 2010-05-11 14:28:14 -0400 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2010-05-18 15:31:10 -0400 |
commit | 3914ed0cec6532ab4feb202424fc95ad05024497 (patch) | |
tree | 034377b0e2cf83e3a6fca5883ea8e4e5191a469a /fs/ocfs2/dlm | |
parent | c1631d4a484fbb498e35d661f1aebd64c86b66bf (diff) |
fs/ocfs2/dlm: Drop memory allocation cast
Drop cast on the result of kmalloc and similar functions.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
type T;
@@
- (T *)
(\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\)(...))
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/dlm')
-rw-r--r-- | fs/ocfs2/dlm/dlmlock.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmmaster.c | 18 |
2 files changed, 7 insertions, 13 deletions
diff --git a/fs/ocfs2/dlm/dlmlock.c b/fs/ocfs2/dlm/dlmlock.c index f1fba2a6a8fe..69cf369961c4 100644 --- a/fs/ocfs2/dlm/dlmlock.c +++ b/fs/ocfs2/dlm/dlmlock.c | |||
@@ -431,7 +431,7 @@ struct dlm_lock * dlm_new_lock(int type, u8 node, u64 cookie, | |||
431 | struct dlm_lock *lock; | 431 | struct dlm_lock *lock; |
432 | int kernel_allocated = 0; | 432 | int kernel_allocated = 0; |
433 | 433 | ||
434 | lock = (struct dlm_lock *) kmem_cache_zalloc(dlm_lock_cache, GFP_NOFS); | 434 | lock = kmem_cache_zalloc(dlm_lock_cache, GFP_NOFS); |
435 | if (!lock) | 435 | if (!lock) |
436 | return NULL; | 436 | return NULL; |
437 | 437 | ||
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index 3114de2e74c7..b01e34819a09 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
@@ -617,13 +617,11 @@ struct dlm_lock_resource *dlm_new_lockres(struct dlm_ctxt *dlm, | |||
617 | { | 617 | { |
618 | struct dlm_lock_resource *res = NULL; | 618 | struct dlm_lock_resource *res = NULL; |
619 | 619 | ||
620 | res = (struct dlm_lock_resource *) | 620 | res = kmem_cache_zalloc(dlm_lockres_cache, GFP_NOFS); |
621 | kmem_cache_zalloc(dlm_lockres_cache, GFP_NOFS); | ||
622 | if (!res) | 621 | if (!res) |
623 | goto error; | 622 | goto error; |
624 | 623 | ||
625 | res->lockname.name = (char *) | 624 | res->lockname.name = kmem_cache_zalloc(dlm_lockname_cache, GFP_NOFS); |
626 | kmem_cache_zalloc(dlm_lockname_cache, GFP_NOFS); | ||
627 | if (!res->lockname.name) | 625 | if (!res->lockname.name) |
628 | goto error; | 626 | goto error; |
629 | 627 | ||
@@ -757,8 +755,7 @@ lookup: | |||
757 | spin_unlock(&dlm->spinlock); | 755 | spin_unlock(&dlm->spinlock); |
758 | mlog(0, "allocating a new resource\n"); | 756 | mlog(0, "allocating a new resource\n"); |
759 | /* nothing found and we need to allocate one. */ | 757 | /* nothing found and we need to allocate one. */ |
760 | alloc_mle = (struct dlm_master_list_entry *) | 758 | alloc_mle = kmem_cache_alloc(dlm_mle_cache, GFP_NOFS); |
761 | kmem_cache_alloc(dlm_mle_cache, GFP_NOFS); | ||
762 | if (!alloc_mle) | 759 | if (!alloc_mle) |
763 | goto leave; | 760 | goto leave; |
764 | res = dlm_new_lockres(dlm, lockid, namelen); | 761 | res = dlm_new_lockres(dlm, lockid, namelen); |
@@ -1542,8 +1539,7 @@ way_up_top: | |||
1542 | spin_unlock(&dlm->master_lock); | 1539 | spin_unlock(&dlm->master_lock); |
1543 | spin_unlock(&dlm->spinlock); | 1540 | spin_unlock(&dlm->spinlock); |
1544 | 1541 | ||
1545 | mle = (struct dlm_master_list_entry *) | 1542 | mle = kmem_cache_alloc(dlm_mle_cache, GFP_NOFS); |
1546 | kmem_cache_alloc(dlm_mle_cache, GFP_NOFS); | ||
1547 | if (!mle) { | 1543 | if (!mle) { |
1548 | response = DLM_MASTER_RESP_ERROR; | 1544 | response = DLM_MASTER_RESP_ERROR; |
1549 | mlog_errno(-ENOMEM); | 1545 | mlog_errno(-ENOMEM); |
@@ -2458,8 +2454,7 @@ static int dlm_migrate_lockres(struct dlm_ctxt *dlm, | |||
2458 | goto leave; | 2454 | goto leave; |
2459 | } | 2455 | } |
2460 | 2456 | ||
2461 | mle = (struct dlm_master_list_entry *) kmem_cache_alloc(dlm_mle_cache, | 2457 | mle = kmem_cache_alloc(dlm_mle_cache, GFP_NOFS); |
2462 | GFP_NOFS); | ||
2463 | if (!mle) { | 2458 | if (!mle) { |
2464 | mlog_errno(ret); | 2459 | mlog_errno(ret); |
2465 | goto leave; | 2460 | goto leave; |
@@ -3041,8 +3036,7 @@ int dlm_migrate_request_handler(struct o2net_msg *msg, u32 len, void *data, | |||
3041 | hash = dlm_lockid_hash(name, namelen); | 3036 | hash = dlm_lockid_hash(name, namelen); |
3042 | 3037 | ||
3043 | /* preallocate.. if this fails, abort */ | 3038 | /* preallocate.. if this fails, abort */ |
3044 | mle = (struct dlm_master_list_entry *) kmem_cache_alloc(dlm_mle_cache, | 3039 | mle = kmem_cache_alloc(dlm_mle_cache, GFP_NOFS); |
3045 | GFP_NOFS); | ||
3046 | 3040 | ||
3047 | if (!mle) { | 3041 | if (!mle) { |
3048 | ret = -ENOMEM; | 3042 | ret = -ENOMEM; |