Convert ERR_PTR(PTR_ERR(p)) instances to ERR_CAST(p)
authorDavid Howells <dhowells@redhat.com>
Thu, 7 Feb 2008 08:15:26 +0000 (00:15 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 7 Feb 2008 16:42:26 +0000 (08:42 -0800)
Convert instances of ERR_PTR(PTR_ERR(p)) to ERR_CAST(p) using:

perl -spi -e 's/ERR_PTR[(]PTR_ERR[(](.*)[)][)]/ERR_CAST(\1)/' `grep -rl 'ERR_PTR[(]*PTR_ERR' fs crypto net security`

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
28 files changed:
crypto/cbc.c
crypto/cryptd.c
crypto/ecb.c
crypto/hmac.c
crypto/lrw.c
crypto/pcbc.c
crypto/xcbc.c
fs/9p/vfs_inode.c
fs/affs/namei.c
fs/afs/dir.c
fs/afs/security.c
fs/fat/inode.c
fs/fuse/dir.c
fs/gfs2/dir.c
fs/gfs2/ops_export.c
fs/gfs2/ops_inode.c
fs/jffs2/write.c
fs/nfs/getroot.c
fs/nfsd/export.c
fs/quota.c
fs/reiserfs/inode.c
fs/reiserfs/xattr.c
fs/vfat/namei.c
net/rxrpc/af_rxrpc.c
security/keys/key.c
security/keys/process_keys.c
security/keys/request_key.c
security/keys/request_key_auth.c

index 6affff882cf835bb88f43e0e5aa68951a8e2ac1a..61ac42e1e32bb75816c0c1b0a7dd614cd80f4474 100644 (file)
@@ -224,7 +224,7 @@ static struct crypto_instance *crypto_cbc_alloc(struct rtattr **tb)
        alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_CIPHER,
                                  CRYPTO_ALG_TYPE_MASK);
        if (IS_ERR(alg))
-               return ERR_PTR(PTR_ERR(alg));
+               return ERR_CAST(alg);
 
        inst = ERR_PTR(-EINVAL);
        if (!is_power_of_2(alg->cra_blocksize))
index 074298f2f8e392ef56391db7c2029fe07d1489c2..250425263e00e59fad2b5a11436ce5a02b9dbe41 100644 (file)
@@ -230,7 +230,7 @@ static struct crypto_instance *cryptd_alloc_blkcipher(
        alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_BLKCIPHER,
                                  CRYPTO_ALG_TYPE_MASK);
        if (IS_ERR(alg))
-               return ERR_PTR(PTR_ERR(alg));
+               return ERR_CAST(alg);
 
        inst = cryptd_alloc_instance(alg, state);
        if (IS_ERR(inst))
@@ -267,7 +267,7 @@ static struct crypto_instance *cryptd_alloc(struct rtattr **tb)
 
        algt = crypto_get_attr_type(tb);
        if (IS_ERR(algt))
-               return ERR_PTR(PTR_ERR(algt));
+               return ERR_CAST(algt);
 
        switch (algt->type & algt->mask & CRYPTO_ALG_TYPE_MASK) {
        case CRYPTO_ALG_TYPE_BLKCIPHER:
index 6310387a872c6c4df4dd538a3d60f25c70391590..a46838e98a71a18de0b4adcdd46a5f65fa556be6 100644 (file)
@@ -128,7 +128,7 @@ static struct crypto_instance *crypto_ecb_alloc(struct rtattr **tb)
        alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_CIPHER,
                                  CRYPTO_ALG_TYPE_MASK);
        if (IS_ERR(alg))
-               return ERR_PTR(PTR_ERR(alg));
+               return ERR_CAST(alg);
 
        inst = crypto_alloc_instance("ecb", alg);
        if (IS_ERR(inst))
index a1d016a50e7debd10f6b7030f44d598b6eccedb3..b60c3c7aa320ba08548c050f4fc05d231321de61 100644 (file)
@@ -213,7 +213,7 @@ static struct crypto_instance *hmac_alloc(struct rtattr **tb)
        alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_HASH,
                                  CRYPTO_ALG_TYPE_HASH_MASK);
        if (IS_ERR(alg))
-               return ERR_PTR(PTR_ERR(alg));
+               return ERR_CAST(alg);
 
        inst = crypto_alloc_instance("hmac", alg);
        if (IS_ERR(inst))
index 621095db28b354fa314acb44528f514baf026cf5..9d52e580d10a4d34b5117f801f98cf6bd4249b5c 100644 (file)
@@ -241,7 +241,7 @@ static struct crypto_instance *alloc(struct rtattr **tb)
        alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_CIPHER,
                                  CRYPTO_ALG_TYPE_MASK);
        if (IS_ERR(alg))
-               return ERR_PTR(PTR_ERR(alg));
+               return ERR_CAST(alg);
 
        inst = crypto_alloc_instance("lrw", alg);
        if (IS_ERR(inst))
index fe704775f88ff0fa526a197201c1a751a8535611..d1b8bdfb58551e5b7844ec423f834f468fe9f3f1 100644 (file)
@@ -234,7 +234,7 @@ static struct crypto_instance *crypto_pcbc_alloc(struct rtattr **tb)
        alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_CIPHER,
                                  CRYPTO_ALG_TYPE_MASK);
        if (IS_ERR(alg))
-               return ERR_PTR(PTR_ERR(alg));
+               return ERR_CAST(alg);
 
        inst = crypto_alloc_instance("pcbc", alg);
        if (IS_ERR(inst))
index a82959df678c3741f17b9a6bb30bbaf63a540524..86727403e5ab1f0e5e7bbd15f3703046f4390548 100644 (file)
@@ -301,7 +301,7 @@ static struct crypto_instance *xcbc_alloc(struct rtattr **tb)
        alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_CIPHER,
                                  CRYPTO_ALG_TYPE_MASK);
        if (IS_ERR(alg))
-               return ERR_PTR(PTR_ERR(alg));
+               return ERR_CAST(alg);
 
        switch(alg->cra_blocksize) {
        case 16:
index 5c5137c11484d22f22c18412a3d26ad231e898cc..6a28842052eac1ccf3c600817b3722c344036e7d 100644 (file)
@@ -573,7 +573,7 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
        v9ses = v9fs_inode2v9ses(dir);
        dfid = v9fs_fid_lookup(dentry->d_parent);
        if (IS_ERR(dfid))
-               return ERR_PTR(PTR_ERR(dfid));
+               return ERR_CAST(dfid);
 
        name = (char *) dentry->d_name.name;
        fid = p9_client_walk(dfid, 1, &name, 1);
index a42143ca01698e1ba64769d5d9eb1bc0aa095320..b407e9eea3fbf96a290255b4c881705f4e03c372 100644 (file)
@@ -209,7 +209,7 @@ affs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
        bh = affs_find_entry(dir, dentry);
        affs_unlock_dir(dir);
        if (IS_ERR(bh)) {
-               return ERR_PTR(PTR_ERR(bh));
+               return ERR_CAST(bh);
        }
        if (bh) {
                u32 ino = bh->b_blocknr;
index 0cc3597c11971380716d10083eee9fa7660f82dd..b58af8f18bc4d36a849e7f314b9c809834a96bae 100644 (file)
@@ -512,7 +512,7 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
        key = afs_request_key(vnode->volume->cell);
        if (IS_ERR(key)) {
                _leave(" = %ld [key]", PTR_ERR(key));
-               return ERR_PTR(PTR_ERR(key));
+               return ERR_CAST(key);
        }
 
        ret = afs_validate(vnode, key);
@@ -540,7 +540,7 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
        key_put(key);
        if (IS_ERR(inode)) {
                _leave(" = %ld", PTR_ERR(inode));
-               return ERR_PTR(PTR_ERR(inode));
+               return ERR_CAST(inode);
        }
 
        dentry->d_op = &afs_fs_dentry_operations;
index 566fe712c68297c63c5a7fea80eedc83402a937d..9446a1fd108a35452579df735f4877f6ad992a6f 100644 (file)
@@ -95,7 +95,7 @@ static struct afs_vnode *afs_get_auth_inode(struct afs_vnode *vnode,
                auth_inode = afs_iget(vnode->vfs_inode.i_sb, key,
                                      &vnode->status.parent, NULL, NULL);
                if (IS_ERR(auth_inode))
-                       return ERR_PTR(PTR_ERR(auth_inode));
+                       return ERR_CAST(auth_inode);
        }
 
        auth_vnode = AFS_FS_I(auth_inode);
index 24c0aaa5ae80d6de0cb876f554da57f2cca864b7..3a3d491bbcfe2b0e298cd020367b56914db8ea75 100644 (file)
@@ -760,7 +760,7 @@ static struct dentry *fat_get_parent(struct dentry *child)
        inode = fat_build_inode(child->d_sb, de, i_pos);
        brelse(bh);
        if (IS_ERR(inode)) {
-               parent = ERR_PTR(PTR_ERR(inode));
+               parent = ERR_CAST(inode);
                goto out;
        }
        parent = d_alloc_anon(inode);
index f56f91bd38bea8b978bb26c38d8e3e3bb993e00a..7fb514b6d85294cfb76fe3fc94c681b6292834c4 100644 (file)
@@ -269,12 +269,12 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
 
        req = fuse_get_req(fc);
        if (IS_ERR(req))
-               return ERR_PTR(PTR_ERR(req));
+               return ERR_CAST(req);
 
        forget_req = fuse_get_req(fc);
        if (IS_ERR(forget_req)) {
                fuse_put_request(fc, req);
-               return ERR_PTR(PTR_ERR(forget_req));
+               return ERR_CAST(forget_req);
        }
 
        attr_version = fuse_get_attr_version(fc);
@@ -1006,7 +1006,7 @@ static char *read_link(struct dentry *dentry)
        char *link;
 
        if (IS_ERR(req))
-               return ERR_PTR(PTR_ERR(req));
+               return ERR_CAST(req);
 
        link = (char *) __get_free_page(GFP_KERNEL);
        if (!link) {
index 57e2ed932adc1d910120d7d6c618210dfb20141f..c34709512b19053088b79bab935a8a93d2374ae4 100644 (file)
@@ -1498,7 +1498,7 @@ struct inode *gfs2_dir_search(struct inode *dir, const struct qstr *name)
        dent = gfs2_dirent_search(dir, name, gfs2_dirent_find, &bh);
        if (dent) {
                if (IS_ERR(dent))
-                       return ERR_PTR(PTR_ERR(dent));
+                       return ERR_CAST(dent);
                inode = gfs2_inode_lookup(dir->i_sb, 
                                be16_to_cpu(dent->de_type),
                                be64_to_cpu(dent->de_inum.no_addr),
index b9da62348a877303a777884c35f08c2083e640d5..334c7f85351bcd5397c7749aa009d56ed4e6608b 100644 (file)
@@ -143,7 +143,7 @@ static struct dentry *gfs2_get_parent(struct dentry *child)
         * have to return that as a(n invalid) pointer to dentry.
         */
        if (IS_ERR(inode))
-               return ERR_PTR(PTR_ERR(inode));
+               return ERR_CAST(inode);
 
        dentry = d_alloc_anon(inode);
        if (!dentry) {
index 9f71372c1757b04f17c0295b01a4a6fc17398cde..e87412902bed76313428bdeb7d7c3e9e1f476d59 100644 (file)
@@ -111,7 +111,7 @@ static struct dentry *gfs2_lookup(struct inode *dir, struct dentry *dentry,
 
        inode = gfs2_lookupi(dir, &dentry->d_name, 0, nd);
        if (inode && IS_ERR(inode))
-               return ERR_PTR(PTR_ERR(inode));
+               return ERR_CAST(inode);
 
        if (inode) {
                struct gfs2_glock *gl = GFS2_I(inode)->i_gl;
index 147e2cbee9e465168f37f0837c2ea04854eadb1f..1b88e6e734efa17e9c0c4e517b984bf3759640c4 100644 (file)
@@ -177,7 +177,7 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
                void *hold_err = fn->raw;
                /* Release the full_dnode which is now useless, and return */
                jffs2_free_full_dnode(fn);
-               return ERR_PTR(PTR_ERR(hold_err));
+               return ERR_CAST(hold_err);
        }
        fn->ofs = je32_to_cpu(ri->offset);
        fn->size = je32_to_cpu(ri->dsize);
@@ -313,7 +313,7 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
                void *hold_err = fd->raw;
                /* Release the full_dirent which is now useless, and return */
                jffs2_free_full_dirent(fd);
-               return ERR_PTR(PTR_ERR(hold_err));
+               return ERR_CAST(hold_err);
        }
 
        if (retried) {
index e6242cdbaf9198147d9b5225ac08cc8df630b001..fae97196daadb74c1dd1c28a5767460557402478 100644 (file)
@@ -96,7 +96,7 @@ struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh)
        inode = nfs_fhget(sb, mntfh, fsinfo.fattr);
        if (IS_ERR(inode)) {
                dprintk("nfs_get_root: get root inode failed\n");
-               return ERR_PTR(PTR_ERR(inode));
+               return ERR_CAST(inode);
        }
 
        error = nfs_superblock_set_dummy_root(sb, inode);
@@ -266,7 +266,7 @@ struct dentry *nfs4_get_root(struct super_block *sb, struct nfs_fh *mntfh)
        inode = nfs_fhget(sb, mntfh, &fattr);
        if (IS_ERR(inode)) {
                dprintk("nfs_get_root: get root inode failed\n");
-               return ERR_PTR(PTR_ERR(inode));
+               return ERR_CAST(inode);
        }
 
        error = nfs_superblock_set_dummy_root(sb, inode);
index 79b4bf8129602b9ebbbec979960d614e90b7185b..346570f6d8481fa4b6b1593333d45a34abc3a824 100644 (file)
@@ -1218,13 +1218,13 @@ static struct svc_export *exp_find(struct auth_domain *clp, int fsid_type,
        struct svc_export *exp;
        struct svc_expkey *ek = exp_find_key(clp, fsid_type, fsidv, reqp);
        if (IS_ERR(ek))
-               return ERR_PTR(PTR_ERR(ek));
+               return ERR_CAST(ek);
 
        exp = exp_get_by_name(clp, ek->ek_mnt, ek->ek_dentry, reqp);
        cache_put(&ek->h, &svc_expkey_cache);
 
        if (IS_ERR(exp))
-               return ERR_PTR(PTR_ERR(exp));
+               return ERR_CAST(exp);
        return exp;
 }
 
index 99b24b52bfc83cbd8f851044dbe2ae27f8e1fc4b..84f28dd721163eb5ef09166bb3d96569c9724b6a 100644 (file)
@@ -341,11 +341,11 @@ static inline struct super_block *quotactl_block(const char __user *special)
        char *tmp = getname(special);
 
        if (IS_ERR(tmp))
-               return ERR_PTR(PTR_ERR(tmp));
+               return ERR_CAST(tmp);
        bdev = lookup_bdev(tmp);
        putname(tmp);
        if (IS_ERR(bdev))
-               return ERR_PTR(PTR_ERR(bdev));
+               return ERR_CAST(bdev);
        sb = get_super(bdev);
        bdput(bdev);
        if (!sb)
index 195309857e6323048e20b2286952e56b754b5301..57917932212eb33d68a0f626766c79fb608c442a 100644 (file)
@@ -1536,7 +1536,7 @@ static struct dentry *reiserfs_get_dentry(struct super_block *sb,
        if (!inode)
                inode = ERR_PTR(-ESTALE);
        if (IS_ERR(inode))
-               return ERR_PTR(PTR_ERR(inode));
+               return ERR_CAST(inode);
        result = d_alloc_anon(inode);
        if (!result) {
                iput(inode);
index a5bd23ce0e46fde64420455c7097338954da0f76..eba037b3338fe8c2c480318d38441d3de65aab51 100644 (file)
@@ -155,7 +155,7 @@ static struct dentry *get_xa_file_dentry(const struct inode *inode,
 
        xadir = open_xa_dir(inode, flags);
        if (IS_ERR(xadir)) {
-               return ERR_PTR(PTR_ERR(xadir));
+               return ERR_CAST(xadir);
        } else if (xadir && !xadir->d_inode) {
                dput(xadir);
                return ERR_PTR(-ENODATA);
@@ -164,7 +164,7 @@ static struct dentry *get_xa_file_dentry(const struct inode *inode,
        xafile = lookup_one_len(name, xadir, strlen(name));
        if (IS_ERR(xafile)) {
                dput(xadir);
-               return ERR_PTR(PTR_ERR(xafile));
+               return ERR_CAST(xafile);
        }
 
        if (xafile->d_inode) {  /* file exists */
index c28add2fbe95eebce0ec79de64e8389be793ea26..cd450bea9f1a179220364e9d42e48561a4d860a1 100644 (file)
@@ -705,7 +705,7 @@ static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry,
        brelse(sinfo.bh);
        if (IS_ERR(inode)) {
                unlock_kernel();
-               return ERR_PTR(PTR_ERR(inode));
+               return ERR_CAST(inode);
        }
        alias = d_find_alias(inode);
        if (alias) {
index 5e82f1c0afbbee2120f489447ae4b7092e7aed18..2d0c29c837f72d3308242d4d30fd0f038ca4af57 100644 (file)
@@ -239,7 +239,7 @@ static struct rxrpc_transport *rxrpc_name_to_transport(struct socket *sock,
        /* find a remote transport endpoint from the local one */
        peer = rxrpc_get_peer(srx, gfp);
        if (IS_ERR(peer))
-               return ERR_PTR(PTR_ERR(peer));
+               return ERR_CAST(peer);
 
        /* find a transport */
        trans = rxrpc_get_transport(rx->local, peer, gfp);
@@ -282,7 +282,7 @@ struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *sock,
                trans = rxrpc_name_to_transport(sock, (struct sockaddr *) srx,
                                                sizeof(*srx), 0, gfp);
                if (IS_ERR(trans)) {
-                       call = ERR_PTR(PTR_ERR(trans));
+                       call = ERR_CAST(trans);
                        trans = NULL;
                        goto out;
                }
@@ -306,7 +306,7 @@ struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *sock,
 
        bundle = rxrpc_get_bundle(rx, trans, key, service_id, gfp);
        if (IS_ERR(bundle)) {
-               call = ERR_PTR(PTR_ERR(bundle));
+               call = ERR_CAST(bundle);
                goto out;
        }
 
index fdd5ca6d89fc1680975604d28ffa261398c650a6..654d23baf3525ceee6134f75039a4d450fc1edd9 100644 (file)
@@ -820,7 +820,7 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
        key = key_alloc(ktype, description, current->fsuid, current->fsgid,
                        current, perm, flags);
        if (IS_ERR(key)) {
-               key_ref = ERR_PTR(PTR_ERR(key));
+               key_ref = ERR_CAST(key);
                goto error_3;
        }
 
index 2a0eb946fc7ee84f95b7b32cc39149c8e510a2f5..c886a2bb792ae034950ec71aa20af5fd1d4c17ee 100644 (file)
@@ -660,7 +660,7 @@ key_ref_t lookup_user_key(struct task_struct *context, key_serial_t id,
 
                key = key_lookup(id);
                if (IS_ERR(key)) {
-                       key_ref = ERR_PTR(PTR_ERR(key));
+                       key_ref = ERR_CAST(key);
                        goto error;
                }
 
index 6381e616c47744904b6efe0f412b0039289bec7d..5ecc5057fb542c1bb9f914e72f4b95695d05dd70 100644 (file)
@@ -389,7 +389,7 @@ struct key *request_key_and_link(struct key_type *type,
        if (!IS_ERR(key_ref)) {
                key = key_ref_to_ptr(key_ref);
        } else if (PTR_ERR(key_ref) != -EAGAIN) {
-               key = ERR_PTR(PTR_ERR(key_ref));
+               key = ERR_CAST(key_ref);
        } else  {
                /* the search failed, but the keyrings were searchable, so we
                 * should consult userspace if we can */
index 510f7be73a2d4e954cc8de34bed9580e5cc4a47b..e42b5252486fe07eb623f413ec61cc7073758da8 100644 (file)
@@ -261,7 +261,7 @@ struct key *key_get_instantiation_authkey(key_serial_t target_id)
                current);
 
        if (IS_ERR(authkey_ref)) {
-               authkey = ERR_PTR(PTR_ERR(authkey_ref));
+               authkey = ERR_CAST(authkey_ref);
                goto error;
        }