From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6908398272512 X-Google-Groups: outreachy-kernel X-Google-Thread: 9ca63f596c,b685cdfa4bc5c8fb,start X-Google-Attributes: gid9ca63f596c,domainid0,private,googlegroup X-Google-NewGroupId: yes X-Received: by 10.66.221.165 with SMTP id qf5mr14495400pac.30.1425651811128; Fri, 06 Mar 2015 06:23:31 -0800 (PST) X-BeenThere: outreachy-kernel@googlegroups.com Received: by 10.50.114.4 with SMTP id jc4ls162487igb.23.canary; Fri, 06 Mar 2015 06:23:30 -0800 (PST) X-Received: by 10.42.142.69 with SMTP id r5mr7469023icu.3.1425651810764; Fri, 06 Mar 2015 06:23:30 -0800 (PST) Return-Path: Received: from mail-pd0-x236.google.com (mail-pd0-x236.google.com. [2607:f8b0:400e:c02::236]) by gmr-mx.google.com with ESMTPS id hs7si1355777pad.1.2015.03.06.06.23.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Mar 2015 06:23:30 -0800 (PST) Received-SPF: pass (google.com: domain of navyasri.tech@gmail.com designates 2607:f8b0:400e:c02::236 as permitted sender) client-ip=2607:f8b0:400e:c02::236; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of navyasri.tech@gmail.com designates 2607:f8b0:400e:c02::236 as permitted sender) smtp.mail=navyasri.tech@gmail.com; dkim=pass header.i=@gmail.com; dmarc=pass (p=NONE dis=NONE) header.from=gmail.com Received: by pdbnh10 with SMTP id nh10so49573354pdb.4 for ; Fri, 06 Mar 2015 06:23:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=sG9EJLfI9KwVAYVr8X+Fob6wm5NzZM2XVyRdc3vHefk=; b=r6z3K2u1yM7n6sM6WSusQ6UE45ahxt467jiSErd/29gB8UCdR+C8xvOBsDCwI7aqMH lpwb2qOEnOjlTl+Ca2/JanfvxlK6f5P4d+1bdslS3r7Iai2zyS+SCislpx/r+fhRenRq 4JiQx/gYHJ82TXnMuK2tQVVGA+GUjMH6MXWOX31mPJhUtWj/r7jk5TvUarAseaZ0PV8A +7dC5iwVffD70UyS8y7NWkux4HTJhTqShHeF6dtyHYI+A1dM1ActmoMBMV1yVhU2XgDi mMnJgVhwEeac9J/RH39rtlajk9M/Omlq+Tb0L6m0Av1fUbAcCneV+3KYpk0a8a0NpAsE qenQ== X-Received: by 10.70.23.165 with SMTP id n5mr26022406pdf.60.1425651810618; Fri, 06 Mar 2015 06:23:30 -0800 (PST) Return-Path: Received: from nizamkari ([61.16.142.166]) by mx.google.com with ESMTPSA id om9sm9704505pbb.34.2015.03.06.06.23.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 06 Mar 2015 06:23:30 -0800 (PST) Date: Fri, 6 Mar 2015 19:54:53 +0530 From: Navya Sri Nizamkari To: outreachy-kernel@googlegroups.com Subject: [PATCH 0/8] Transform kzalloc calls to kcalloc Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) This patchset changes some kzalloc calls to kcalloc. The semantic patch used to make this change is: @@ type T, T2; expression x; identifier f,f1; expression E1,E2,E3,E4; statement S,S1,S2; @@ - x = (T)kmalloc(E1,E2) + x = kzalloc(E1,E2) ... when != \(f(...,x,...)\|<+...x...+>=E3\) when != \(while(...) S\|for(...;...;...) S\) ( if ((x!=NULL)&&...) { ... when != \(f1(...,x,...)\|<+...x...+>=E4\) when != \(while(...) S1\|for(...;...;...) S1\) - memset((T2)x,0,E1); ... } else S2 | - memset((T2)x,0,E1); ) @@ type T, T2; type T1; T1 *x; T1 *y; identifier f,f1; expression E2,E3,E4; statement S,S1,S2; @@ - x = (T)kmalloc(sizeof(T1),E2) + x = kzalloc(sizeof(T1),E2) ... when != \(f(...,x,...)\|<+...x...+>=E3\) when != \(while(...) S\|for(...;...;...) S\) ( if ((x!=NULL)&&...) { ... when != \(f1(...,x,...)\|<+...x...+>=E4\) when != \(while(...) S1\|for(...;...;...) S1\) - memset((T2)x,0,sizeof(*y)); ... } else S2 | - memset((T2)x,0,sizeof(*y)); ) @@ type T, T2; type T1; T1 *x; T1 *y; identifier f,f1; expression E,E2,E3,E4; statement S,S1,S2; @@ - x = (T)kmalloc(sizeof(T1)*E,E2) + x = kzalloc(sizeof(T1)*E,E2) ... when != \(f(...,x,...)\|<+...x...+>=E3\) when != \(while(...) S\|for(...;...;...) S\) ( if ((x!=NULL)&&...) { ... when != \(f1(...,x,...)\|<+...x...+>=E4\) when != \(while(...) S1\|for(...;...;...) S1\) - memset((T2)x,0,sizeof(*y)*E); ... } else S2 | - memset((T2)x,0,sizeof(*y)*E); ) @@ type T, T2; type T1; T1 *x; T1 *y; identifier f,f1; expression E2,E3,E4; statement S,S1,S2; @@ - x = (T)kmalloc(sizeof(*y),E2) + x = kzalloc(sizeof(*y),E2) ... when != \(f(...,x,...)\|<+...x...+>=E3\) when != \(while(...) S\|for(...;...;...) S\) ( if ((x!=NULL)&&...) { ... when != \(f1(...,x,...)\|<+...x...+>=E4\) when != \(while(...) S1\|for(...;...;...) S1\) - memset((T2)x,0,sizeof(T1)); ... } else S2 | - memset((T2)x,0,sizeof(T1)); ) @@ type T, T2; type T1; T1 *x; T1 *y; identifier f,f1; expression E,E2,E3,E4; statement S,S1,S2; @@ - x = (T)kmalloc(sizeof(*y)*E,E2) + x = kzalloc(sizeof(*y)*E,E2) ... when != \(f(...,x,...)\|<+...x...+>=E3\) when != \(while(...) S\|for(...;...;...) S\) ( if ((x!=NULL)&&...) { ... when != \(f1(...,x,...)\|<+...x...+>=E4\) when != \(while(...) S1\|for(...;...;...) S1\) - memset((T2)x,0,sizeof(T1)*E); ... } else S2 | - memset((T2)x,0,sizeof(T1)*E); ) @ disable neg_if, mult_comm @ type T, T2; expression x; identifier f,f1; expression E0,E1,E2,E3,E4; statement S,S1,S2; @@ - x = (T)kmalloc(E0 * E1,E2) + x = kzalloc(E0 * E1,E2) ... when != \(f(...,x,...)\|<+...x...+>=E3\) when != \(while(...) S\|for(...;...;...) S\) ( if ((x!=NULL)&&...) { ... when != \(f1(...,x,...)\|<+...x...+>=E4\) when != \(while(...) S1\|for(...;...;...) S1\) - memset((T2)x,0,E1 * E0); ... } else S2 | - memset((T2)x,0,E1 * E0); ) // --------------------------------------------------------------------- // --------------------------------------------------------------------- // have to duplicate everything again to make a version with no braces //\(x->fld\|f(...,x,...)\|x=E\) @@ type T, T2; expression x; identifier f; expression E1,E2,E3; statement S,S2; @@ - x = (T)kmalloc(E1,E2) + x = kzalloc(E1,E2) ... when != \(f(...,x,...)\|<+...x...+>=E3\) when != \(while(...) S\|for(...;...;...) S\) ( - if ((x!=NULL)&&...) memset((T2)x,0,E1); | + if (!x) - if ((x!=NULL)&&...) memset((T2)x,0,E1); else S2 ) @ @ type T, T2; type T1; T1 *x; T1 *y; identifier f; expression E2,E3; statement S,S2; @@ - x = (T)kmalloc(sizeof(T1),E2) + x = kzalloc(sizeof(T1),E2) ... when != \(f(...,x,...)\|<+...x...+>=E3\) when != \(while(...) S\|for(...;...;...) S\) ( - if ((x!=NULL)&&...) memset((T2)x,0,sizeof(*y)); | + if (!x) - if ((x!=NULL)&&...) memset((T2)x,0,sizeof(*y)); else S2 ) @@ type T, T2; type T1; T1 *x; T1 *y; identifier f; expression E,E2,E3; statement S,S2; @@ - x = (T)kmalloc(sizeof(T1)*E,E2) + x = kzalloc(sizeof(T1)*E,E2) ... when != \(f(...,x,...)\|<+...x...+>=E3\) when != \(while(...) S\|for(...;...;...) S\) ( - if ((x!=NULL)&&...) memset((T2)x,0,sizeof(*y)*E); | + if (!x) - if ((x!=NULL)&&...) memset((T2)x,0,sizeof(*y)*E); else S2 ) @@ type T, T2; type T1; T1 *x; T1 *y; identifier f; expression E2,E3; statement S,S2; @@ - x = (T)kmalloc(sizeof(*y),E2) + x = kzalloc(sizeof(*y),E2) ... when != \(f(...,x,...)\|<+...x...+>=E3\) when != \(while(...) S\|for(...;...;...) S\) ( - if ((x!=NULL)&&...) memset((T2)x,0,sizeof(T1)); | + if (!x) - if ((x!=NULL)&&...) memset((T2)x,0,sizeof(T1)); else S2 ) @@ type T, T2; type T1; T1 *x; T1 *y; identifier f; expression E,E2,E3; statement S,S2; @@ - x = (T)kmalloc(sizeof(*y)*E,E2) + x = kzalloc(sizeof(*y)*E,E2) ... when != \(f(...,x,...)\|<+...x...+>=E3\) when != \(while(...) S\|for(...;...;...) S\) ( - if ((x!=NULL)&&...) memset((T2)x,0,sizeof(T1)*E); | + if (!x) - if ((x!=NULL)&&...) memset((T2)x,0,sizeof(T1)*E); else S2 ) @ disable neg_if, mult_comm @ type T, T2; expression x; identifier f; expression E0,E1,E2,E3; statement S,S2; @@ - x = (T)kmalloc(E0 * E1,E2) + x = kzalloc(E0 * E1,E2) ... when != \(f(...,x,...)\|<+...x...+>=E3\) when != \(while(...) S\|for(...;...;...) S\) ( - if ((x!=NULL)&&...) memset((T2)x,0,E1 * E0); | + if (!x) - if ((x!=NULL)&&...) memset((T2)x,0,E1 * E0); else S2 ) // --------------------------------------------------------------------- @@ expression E; statement S; @@ kzalloc(...) ... if (E) S - else { } // --------------------------------------------------------------------- // --------------------------------------------------------------------- @@ expression E1,E2,E3; @@ - kzalloc(E1*sizeof(E2),E3) + kcalloc(E1,sizeof(E2),E3) @@ expression E1,E3; type T; @@ - kzalloc(E1*sizeof(T),E3) + kcalloc(E1,sizeof(T),E3) @@ expression E1,E2,E3,E4; @@ - kzalloc(E1*E2*sizeof(E3),E4) + kcalloc(E1*E2,sizeof(E3),E4) @@ expression E1,E2,E3; type T; @@ - kzalloc(E1*E2*sizeof(T),E3) + kcalloc(E1*E2,sizeof(T),E3) @@ expression E1,E2,E3,E4; @@ - kzalloc(sizeof(E3)*E1*E2,E4) + kcalloc(E1*E2,sizeof(E3),E4) @@ expression E1,E2,E3; type T; @@ - kzalloc(sizeof(T)*E1*E2,E3) + kcalloc(E1*E2,sizeof(T),E3) @@ constant E1; expression E2,E3; @@ - kzalloc(E1*E2,E3) + kcalloc(E1,E2,E3) Navya Sri Nizamkari (8): staging: rtl8188eu: Use kcalloc instead of kzalloc. staging: rtl8188eu: Use kcalloc instead of kzalloc staging: dgnc: Use kcalloc instead of kzalloc. staging: iio: Use kcalloc instead of kzalloc. staging: iio: Use kcalloc instead of kzalloc staging: media: Use kcalloc instead of kzalloc. staging: media: Use kcalloc instead of kzalloc staging: unisys: Use kcalloc instead of kzalloc. drivers/staging/dgnc/dgnc_driver.c | 2 +- drivers/staging/iio/accel/lis3l02dq_ring.c | 2 +- drivers/staging/iio/adc/ad7280a.c | 5 +++-- drivers/staging/media/bcm2048/radio-bcm2048.c | 2 +- drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c | 7 ++++--- drivers/staging/rtl8188eu/core/rtw_xmit.c | 3 ++- drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c | 2 +- drivers/staging/unisys/visorutil/procobjecttree.c | 6 +++--- 8 files changed, 16 insertions(+), 13 deletions(-) -- 1.9.1