mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
[PATCH] getting rid of all casts of k[cmz]alloc() calls
Run this: #!/bin/sh for f in $(grep -Erl "\([^\)]*\) *k[cmz]alloc" *) ; do echo "De-casting $f..." perl -pi -e "s/ ?= ?\([^\)]*\) *(k[cmz]alloc) *\(/ = \1\(/" $f done And then go through and reinstate those cases where code is casting pointers to non-pointers. And then drop a few hunks which conflicted with outstanding work. Cc: Russell King <[email protected]>, Ian Molton <[email protected]> Cc: Mikael Starvik <[email protected]> Cc: Yoshinori Sato <[email protected]> Cc: Roman Zippel <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Ralf Baechle <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Kyle McMartin <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Martin Schwidefsky <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Jeff Dike <[email protected]> Cc: Greg KH <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Paul Fulghum <[email protected]> Cc: Alan Cox <[email protected]> Cc: Karsten Keil <[email protected]> Cc: Mauro Carvalho Chehab <[email protected]> Cc: Jeff Garzik <[email protected]> Cc: James Bottomley <[email protected]> Cc: Ian Kent <[email protected]> Cc: Steven French <[email protected]> Cc: David Woodhouse <[email protected]> Cc: Neil Brown <[email protected]> Cc: Jaroslav Kysela <[email protected]> Cc: Takashi Iwai <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
0743b86800
commit
5cbded585d
172 changed files with 250 additions and 250 deletions
|
|
@ -313,7 +313,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
|
|||
struct autofs_sb_info *sbi;
|
||||
struct autofs_info *ino;
|
||||
|
||||
sbi = (struct autofs_sb_info *) kmalloc(sizeof(*sbi), GFP_KERNEL);
|
||||
sbi = kmalloc(sizeof(*sbi), GFP_KERNEL);
|
||||
if ( !sbi )
|
||||
goto fail_unlock;
|
||||
DPRINTK("starting up, sbi = %p",sbi);
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ befs_btree_find(struct super_block *sb, befs_data_stream * ds,
|
|||
goto error;
|
||||
}
|
||||
|
||||
this_node = (befs_btree_node *) kmalloc(sizeof (befs_btree_node),
|
||||
this_node = kmalloc(sizeof (befs_btree_node),
|
||||
GFP_NOFS);
|
||||
if (!this_node) {
|
||||
befs_error(sb, "befs_btree_find() failed to allocate %u "
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ void
|
|||
befs_error(const struct super_block *sb, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char *err_buf = (char *) kmalloc(ERRBUFSIZE, GFP_KERNEL);
|
||||
char *err_buf = kmalloc(ERRBUFSIZE, GFP_KERNEL);
|
||||
if (err_buf == NULL) {
|
||||
printk(KERN_ERR "could not allocate %d bytes\n", ERRBUFSIZE);
|
||||
return;
|
||||
|
|
@ -46,7 +46,7 @@ void
|
|||
befs_warning(const struct super_block *sb, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char *err_buf = (char *) kmalloc(ERRBUFSIZE, GFP_KERNEL);
|
||||
char *err_buf = kmalloc(ERRBUFSIZE, GFP_KERNEL);
|
||||
if (err_buf == NULL) {
|
||||
printk(KERN_ERR "could not allocate %d bytes\n", ERRBUFSIZE);
|
||||
return;
|
||||
|
|
@ -70,7 +70,7 @@ befs_debug(const struct super_block *sb, const char *fmt, ...)
|
|||
char *err_buf = NULL;
|
||||
|
||||
if (BEFS_SB(sb)->mount_opts.debug) {
|
||||
err_buf = (char *) kmalloc(ERRBUFSIZE, GFP_KERNEL);
|
||||
err_buf = kmalloc(ERRBUFSIZE, GFP_KERNEL);
|
||||
if (err_buf == NULL) {
|
||||
printk(KERN_ERR "could not allocate %d bytes\n",
|
||||
ERRBUFSIZE);
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ static Node *create_entry(const char __user *buffer, size_t count)
|
|||
|
||||
err = -ENOMEM;
|
||||
memsize = sizeof(Node) + count + 8;
|
||||
e = (Node *) kmalloc(memsize, GFP_USER);
|
||||
e = kmalloc(memsize, GFP_USER);
|
||||
if (!e)
|
||||
goto out;
|
||||
|
||||
|
|
|
|||
|
|
@ -4876,7 +4876,7 @@ int CIFSSMBNotify(const int xid, struct cifsTconInfo *tcon,
|
|||
} else {
|
||||
/* Add file to outstanding requests */
|
||||
/* BB change to kmem cache alloc */
|
||||
dnotify_req = (struct dir_notify_req *) kmalloc(
|
||||
dnotify_req = kmalloc(
|
||||
sizeof(struct dir_notify_req),
|
||||
GFP_KERNEL);
|
||||
if(dnotify_req) {
|
||||
|
|
|
|||
|
|
@ -818,7 +818,7 @@ jffs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
|
|||
|
||||
D1({
|
||||
int len = dentry->d_name.len;
|
||||
char *_name = (char *) kmalloc(len + 1, GFP_KERNEL);
|
||||
char *_name = kmalloc(len + 1, GFP_KERNEL);
|
||||
memcpy(_name, dentry->d_name.name, len);
|
||||
_name[len] = '\0';
|
||||
printk("***jffs_mkdir(): dir = 0x%p, name = \"%s\", "
|
||||
|
|
@ -964,7 +964,7 @@ jffs_remove(struct inode *dir, struct dentry *dentry, int type)
|
|||
D1({
|
||||
int len = dentry->d_name.len;
|
||||
const char *name = dentry->d_name.name;
|
||||
char *_name = (char *) kmalloc(len + 1, GFP_KERNEL);
|
||||
char *_name = kmalloc(len + 1, GFP_KERNEL);
|
||||
memcpy(_name, name, len);
|
||||
_name[len] = '\0';
|
||||
printk("***jffs_remove(): file = \"%s\", ino = %ld\n", _name, dentry->d_inode->i_ino);
|
||||
|
|
|
|||
|
|
@ -436,7 +436,7 @@ jffs_checksum_flash(struct mtd_info *mtd, loff_t start, int size, __u32 *result)
|
|||
int i, length;
|
||||
|
||||
/* Allocate read buffer */
|
||||
read_buf = (__u8 *) kmalloc (sizeof(__u8) * 4096, GFP_KERNEL);
|
||||
read_buf = kmalloc(sizeof(__u8) * 4096, GFP_KERNEL);
|
||||
if (!read_buf) {
|
||||
printk(KERN_NOTICE "kmalloc failed in jffs_checksum_flash()\n");
|
||||
return -ENOMEM;
|
||||
|
|
@ -744,11 +744,11 @@ static int check_partly_erased_sectors(struct jffs_fmcontrol *fmc){
|
|||
|
||||
|
||||
/* Allocate read buffers */
|
||||
read_buf1 = (__u8 *) kmalloc (sizeof(__u8) * READ_AHEAD_BYTES, GFP_KERNEL);
|
||||
read_buf1 = kmalloc(sizeof(__u8) * READ_AHEAD_BYTES, GFP_KERNEL);
|
||||
if (!read_buf1)
|
||||
return -ENOMEM;
|
||||
|
||||
read_buf2 = (__u8 *) kmalloc (sizeof(__u8) * READ_AHEAD_BYTES, GFP_KERNEL);
|
||||
read_buf2 = kmalloc(sizeof(__u8) * READ_AHEAD_BYTES, GFP_KERNEL);
|
||||
if (!read_buf2) {
|
||||
kfree(read_buf1);
|
||||
return -ENOMEM;
|
||||
|
|
@ -876,7 +876,7 @@ jffs_scan_flash(struct jffs_control *c)
|
|||
}
|
||||
|
||||
/* Allocate read buffer */
|
||||
read_buf = (__u8 *) kmalloc (sizeof(__u8) * 4096, GFP_KERNEL);
|
||||
read_buf = kmalloc(sizeof(__u8) * 4096, GFP_KERNEL);
|
||||
if (!read_buf) {
|
||||
flash_safe_release(fmc->mtd);
|
||||
return -ENOMEM;
|
||||
|
|
@ -1463,7 +1463,7 @@ jffs_insert_node(struct jffs_control *c, struct jffs_file *f,
|
|||
kfree(f->name);
|
||||
DJM(no_name--);
|
||||
}
|
||||
if (!(f->name = (char *) kmalloc(raw_inode->nsize + 1,
|
||||
if (!(f->name = kmalloc(raw_inode->nsize + 1,
|
||||
GFP_KERNEL))) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
|
@ -1737,7 +1737,7 @@ jffs_find_child(struct jffs_file *dir, const char *name, int len)
|
|||
printk("jffs_find_child(): Found \"%s\".\n", f->name);
|
||||
}
|
||||
else {
|
||||
char *copy = (char *) kmalloc(len + 1, GFP_KERNEL);
|
||||
char *copy = kmalloc(len + 1, GFP_KERNEL);
|
||||
if (copy) {
|
||||
memcpy(copy, name, len);
|
||||
copy[len] = '\0';
|
||||
|
|
@ -2627,7 +2627,7 @@ jffs_print_tree(struct jffs_file *first_file, int indent)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(space = (char *) kmalloc(indent + 1, GFP_KERNEL))) {
|
||||
if (!(space = kmalloc(indent + 1, GFP_KERNEL))) {
|
||||
printk("jffs_print_tree(): Out of memory!\n");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3777,12 +3777,12 @@ static int ciGetLeafPrefixKey(dtpage_t * lp, int li, dtpage_t * rp,
|
|||
struct component_name lkey;
|
||||
struct component_name rkey;
|
||||
|
||||
lkey.name = (wchar_t *) kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t),
|
||||
lkey.name = kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t),
|
||||
GFP_KERNEL);
|
||||
if (lkey.name == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
rkey.name = (wchar_t *) kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t),
|
||||
rkey.name = kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t),
|
||||
GFP_KERNEL);
|
||||
if (rkey.name == NULL) {
|
||||
kfree(lkey.name);
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ int diMount(struct inode *ipimap)
|
|||
* allocate/initialize the in-memory inode map control structure
|
||||
*/
|
||||
/* allocate the in-memory inode map control structure. */
|
||||
imap = (struct inomap *) kmalloc(sizeof(struct inomap), GFP_KERNEL);
|
||||
imap = kmalloc(sizeof(struct inomap), GFP_KERNEL);
|
||||
if (imap == NULL) {
|
||||
jfs_err("diMount: kmalloc returned NULL!");
|
||||
return -ENOMEM;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ nlmsvc_share_file(struct nlm_host *host, struct nlm_file *file,
|
|||
return nlm_lck_denied;
|
||||
}
|
||||
|
||||
share = (struct nlm_share *) kmalloc(sizeof(*share) + oh->len,
|
||||
share = kmalloc(sizeof(*share) + oh->len,
|
||||
GFP_KERNEL);
|
||||
if (share == NULL)
|
||||
return nlm_lck_denied_nolocks;
|
||||
|
|
|
|||
|
|
@ -1877,7 +1877,7 @@ static int nfs4_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir,
|
|||
struct nfs_server *server = NFS_SERVER(dir->d_inode);
|
||||
struct unlink_desc *up;
|
||||
|
||||
up = (struct unlink_desc *) kmalloc(sizeof(*up), GFP_KERNEL);
|
||||
up = kmalloc(sizeof(*up), GFP_KERNEL);
|
||||
if (!up)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ static void *posix_acl_to_disk(const struct posix_acl *acl, size_t * size)
|
|||
int n;
|
||||
|
||||
*size = reiserfs_acl_size(acl->a_count);
|
||||
ext_acl = (reiserfs_acl_header *) kmalloc(sizeof(reiserfs_acl_header) +
|
||||
ext_acl = kmalloc(sizeof(reiserfs_acl_header) +
|
||||
acl->a_count *
|
||||
sizeof(reiserfs_acl_entry),
|
||||
GFP_NOFS);
|
||||
|
|
|
|||
Loading…
Reference in a new issue