mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
some kmalloc/memset ->kzalloc (tree wide)
Transform some calls to kmalloc/memset to a single kzalloc (or kcalloc). Here is a short excerpt of the semantic patch performing this transformation: @@ type T2; expression x; identifier f,fld; expression E; expression E1,E2; expression e1,e2,e3,y; statement S; @@ x = - kmalloc + kzalloc (E1,E2) ... when != \(x->fld=E;\|y=f(...,x,...);\|f(...,x,...);\|x=E;\|while(...) S\|for(e1;e2;e3) S\) - memset((T2)x,0,E1); @@ expression E1,E2,E3; @@ - kzalloc(E1 * E2,E3) + kcalloc(E1,E2,E3) [[email protected]: get kcalloc args the right way around] Signed-off-by: Yoann Padioleau <[email protected]> Cc: Richard Henderson <[email protected]> Cc: Ivan Kokshaysky <[email protected]> Acked-by: Russell King <[email protected]> Cc: Bryan Wu <[email protected]> Acked-by: Jiri Slaby <[email protected]> Cc: Dave Airlie <[email protected]> Acked-by: Roland Dreier <[email protected]> Cc: Jiri Kosina <[email protected]> Acked-by: Dmitry Torokhov <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Acked-by: Mauro Carvalho Chehab <[email protected]> Acked-by: Pierre Ossman <[email protected]> Cc: Jeff Garzik <[email protected]> Cc: "David S. Miller" <[email protected]> Acked-by: Greg KH <[email protected]> Cc: James Bottomley <[email protected]> Cc: "Antonino A. Daplas" <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
3b5ad0797c
commit
dd00cc486a
136 changed files with 157 additions and 330 deletions
|
|
@ -883,13 +883,11 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
|
|||
goto failed_mount;
|
||||
}
|
||||
bgl_lock_init(&sbi->s_blockgroup_lock);
|
||||
sbi->s_debts = kmalloc(sbi->s_groups_count * sizeof(*sbi->s_debts),
|
||||
GFP_KERNEL);
|
||||
sbi->s_debts = kcalloc(sbi->s_groups_count, sizeof(*sbi->s_debts), GFP_KERNEL);
|
||||
if (!sbi->s_debts) {
|
||||
printk ("EXT2-fs: not enough memory\n");
|
||||
goto failed_mount_group_desc;
|
||||
}
|
||||
memset(sbi->s_debts, 0, sbi->s_groups_count * sizeof(*sbi->s_debts));
|
||||
for (i = 0; i < db_count; i++) {
|
||||
block = descriptor_loc(sb, logic_sb_block, i);
|
||||
sbi->s_group_desc[i] = sb_bread(sb, block);
|
||||
|
|
|
|||
Loading…
Reference in a new issue