Commit e231c2ee64eb1c5cd3c63c31da9dac7d888dcf7f

Authored by David Howells
Committed by Linus Torvalds
1 parent d1bc8e9544

Convert ERR_PTR(PTR_ERR(p)) instances to ERR_CAST(p)

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>

Showing 28 changed files with 39 additions and 39 deletions Side-by-side Diff

... ... @@ -224,7 +224,7 @@
224 224 alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_CIPHER,
225 225 CRYPTO_ALG_TYPE_MASK);
226 226 if (IS_ERR(alg))
227   - return ERR_PTR(PTR_ERR(alg));
  227 + return ERR_CAST(alg);
228 228  
229 229 inst = ERR_PTR(-EINVAL);
230 230 if (!is_power_of_2(alg->cra_blocksize))
... ... @@ -230,7 +230,7 @@
230 230 alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_BLKCIPHER,
231 231 CRYPTO_ALG_TYPE_MASK);
232 232 if (IS_ERR(alg))
233   - return ERR_PTR(PTR_ERR(alg));
  233 + return ERR_CAST(alg);
234 234  
235 235 inst = cryptd_alloc_instance(alg, state);
236 236 if (IS_ERR(inst))
... ... @@ -267,7 +267,7 @@
267 267  
268 268 algt = crypto_get_attr_type(tb);
269 269 if (IS_ERR(algt))
270   - return ERR_PTR(PTR_ERR(algt));
  270 + return ERR_CAST(algt);
271 271  
272 272 switch (algt->type & algt->mask & CRYPTO_ALG_TYPE_MASK) {
273 273 case CRYPTO_ALG_TYPE_BLKCIPHER:
... ... @@ -128,7 +128,7 @@
128 128 alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_CIPHER,
129 129 CRYPTO_ALG_TYPE_MASK);
130 130 if (IS_ERR(alg))
131   - return ERR_PTR(PTR_ERR(alg));
  131 + return ERR_CAST(alg);
132 132  
133 133 inst = crypto_alloc_instance("ecb", alg);
134 134 if (IS_ERR(inst))
... ... @@ -213,7 +213,7 @@
213 213 alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_HASH,
214 214 CRYPTO_ALG_TYPE_HASH_MASK);
215 215 if (IS_ERR(alg))
216   - return ERR_PTR(PTR_ERR(alg));
  216 + return ERR_CAST(alg);
217 217  
218 218 inst = crypto_alloc_instance("hmac", alg);
219 219 if (IS_ERR(inst))
... ... @@ -241,7 +241,7 @@
241 241 alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_CIPHER,
242 242 CRYPTO_ALG_TYPE_MASK);
243 243 if (IS_ERR(alg))
244   - return ERR_PTR(PTR_ERR(alg));
  244 + return ERR_CAST(alg);
245 245  
246 246 inst = crypto_alloc_instance("lrw", alg);
247 247 if (IS_ERR(inst))
... ... @@ -234,7 +234,7 @@
234 234 alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_CIPHER,
235 235 CRYPTO_ALG_TYPE_MASK);
236 236 if (IS_ERR(alg))
237   - return ERR_PTR(PTR_ERR(alg));
  237 + return ERR_CAST(alg);
238 238  
239 239 inst = crypto_alloc_instance("pcbc", alg);
240 240 if (IS_ERR(inst))
... ... @@ -301,7 +301,7 @@
301 301 alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_CIPHER,
302 302 CRYPTO_ALG_TYPE_MASK);
303 303 if (IS_ERR(alg))
304   - return ERR_PTR(PTR_ERR(alg));
  304 + return ERR_CAST(alg);
305 305  
306 306 switch(alg->cra_blocksize) {
307 307 case 16:
... ... @@ -573,7 +573,7 @@
573 573 v9ses = v9fs_inode2v9ses(dir);
574 574 dfid = v9fs_fid_lookup(dentry->d_parent);
575 575 if (IS_ERR(dfid))
576   - return ERR_PTR(PTR_ERR(dfid));
  576 + return ERR_CAST(dfid);
577 577  
578 578 name = (char *) dentry->d_name.name;
579 579 fid = p9_client_walk(dfid, 1, &name, 1);
... ... @@ -209,7 +209,7 @@
209 209 bh = affs_find_entry(dir, dentry);
210 210 affs_unlock_dir(dir);
211 211 if (IS_ERR(bh)) {
212   - return ERR_PTR(PTR_ERR(bh));
  212 + return ERR_CAST(bh);
213 213 }
214 214 if (bh) {
215 215 u32 ino = bh->b_blocknr;
... ... @@ -512,7 +512,7 @@
512 512 key = afs_request_key(vnode->volume->cell);
513 513 if (IS_ERR(key)) {
514 514 _leave(" = %ld [key]", PTR_ERR(key));
515   - return ERR_PTR(PTR_ERR(key));
  515 + return ERR_CAST(key);
516 516 }
517 517  
518 518 ret = afs_validate(vnode, key);
... ... @@ -540,7 +540,7 @@
540 540 key_put(key);
541 541 if (IS_ERR(inode)) {
542 542 _leave(" = %ld", PTR_ERR(inode));
543   - return ERR_PTR(PTR_ERR(inode));
  543 + return ERR_CAST(inode);
544 544 }
545 545  
546 546 dentry->d_op = &afs_fs_dentry_operations;
... ... @@ -95,7 +95,7 @@
95 95 auth_inode = afs_iget(vnode->vfs_inode.i_sb, key,
96 96 &vnode->status.parent, NULL, NULL);
97 97 if (IS_ERR(auth_inode))
98   - return ERR_PTR(PTR_ERR(auth_inode));
  98 + return ERR_CAST(auth_inode);
99 99 }
100 100  
101 101 auth_vnode = AFS_FS_I(auth_inode);
... ... @@ -760,7 +760,7 @@
760 760 inode = fat_build_inode(child->d_sb, de, i_pos);
761 761 brelse(bh);
762 762 if (IS_ERR(inode)) {
763   - parent = ERR_PTR(PTR_ERR(inode));
  763 + parent = ERR_CAST(inode);
764 764 goto out;
765 765 }
766 766 parent = d_alloc_anon(inode);
... ... @@ -269,12 +269,12 @@
269 269  
270 270 req = fuse_get_req(fc);
271 271 if (IS_ERR(req))
272   - return ERR_PTR(PTR_ERR(req));
  272 + return ERR_CAST(req);
273 273  
274 274 forget_req = fuse_get_req(fc);
275 275 if (IS_ERR(forget_req)) {
276 276 fuse_put_request(fc, req);
277   - return ERR_PTR(PTR_ERR(forget_req));
  277 + return ERR_CAST(forget_req);
278 278 }
279 279  
280 280 attr_version = fuse_get_attr_version(fc);
... ... @@ -1006,7 +1006,7 @@
1006 1006 char *link;
1007 1007  
1008 1008 if (IS_ERR(req))
1009   - return ERR_PTR(PTR_ERR(req));
  1009 + return ERR_CAST(req);
1010 1010  
1011 1011 link = (char *) __get_free_page(GFP_KERNEL);
1012 1012 if (!link) {
... ... @@ -1498,7 +1498,7 @@
1498 1498 dent = gfs2_dirent_search(dir, name, gfs2_dirent_find, &bh);
1499 1499 if (dent) {
1500 1500 if (IS_ERR(dent))
1501   - return ERR_PTR(PTR_ERR(dent));
  1501 + return ERR_CAST(dent);
1502 1502 inode = gfs2_inode_lookup(dir->i_sb,
1503 1503 be16_to_cpu(dent->de_type),
1504 1504 be64_to_cpu(dent->de_inum.no_addr),
fs/gfs2/ops_export.c
... ... @@ -143,7 +143,7 @@
143 143 * have to return that as a(n invalid) pointer to dentry.
144 144 */
145 145 if (IS_ERR(inode))
146   - return ERR_PTR(PTR_ERR(inode));
  146 + return ERR_CAST(inode);
147 147  
148 148 dentry = d_alloc_anon(inode);
149 149 if (!dentry) {
... ... @@ -111,7 +111,7 @@
111 111  
112 112 inode = gfs2_lookupi(dir, &dentry->d_name, 0, nd);
113 113 if (inode && IS_ERR(inode))
114   - return ERR_PTR(PTR_ERR(inode));
  114 + return ERR_CAST(inode);
115 115  
116 116 if (inode) {
117 117 struct gfs2_glock *gl = GFS2_I(inode)->i_gl;
... ... @@ -177,7 +177,7 @@
177 177 void *hold_err = fn->raw;
178 178 /* Release the full_dnode which is now useless, and return */
179 179 jffs2_free_full_dnode(fn);
180   - return ERR_PTR(PTR_ERR(hold_err));
  180 + return ERR_CAST(hold_err);
181 181 }
182 182 fn->ofs = je32_to_cpu(ri->offset);
183 183 fn->size = je32_to_cpu(ri->dsize);
... ... @@ -313,7 +313,7 @@
313 313 void *hold_err = fd->raw;
314 314 /* Release the full_dirent which is now useless, and return */
315 315 jffs2_free_full_dirent(fd);
316   - return ERR_PTR(PTR_ERR(hold_err));
  316 + return ERR_CAST(hold_err);
317 317 }
318 318  
319 319 if (retried) {
... ... @@ -96,7 +96,7 @@
96 96 inode = nfs_fhget(sb, mntfh, fsinfo.fattr);
97 97 if (IS_ERR(inode)) {
98 98 dprintk("nfs_get_root: get root inode failed\n");
99   - return ERR_PTR(PTR_ERR(inode));
  99 + return ERR_CAST(inode);
100 100 }
101 101  
102 102 error = nfs_superblock_set_dummy_root(sb, inode);
... ... @@ -266,7 +266,7 @@
266 266 inode = nfs_fhget(sb, mntfh, &fattr);
267 267 if (IS_ERR(inode)) {
268 268 dprintk("nfs_get_root: get root inode failed\n");
269   - return ERR_PTR(PTR_ERR(inode));
  269 + return ERR_CAST(inode);
270 270 }
271 271  
272 272 error = nfs_superblock_set_dummy_root(sb, inode);
... ... @@ -1218,13 +1218,13 @@
1218 1218 struct svc_export *exp;
1219 1219 struct svc_expkey *ek = exp_find_key(clp, fsid_type, fsidv, reqp);
1220 1220 if (IS_ERR(ek))
1221   - return ERR_PTR(PTR_ERR(ek));
  1221 + return ERR_CAST(ek);
1222 1222  
1223 1223 exp = exp_get_by_name(clp, ek->ek_mnt, ek->ek_dentry, reqp);
1224 1224 cache_put(&ek->h, &svc_expkey_cache);
1225 1225  
1226 1226 if (IS_ERR(exp))
1227   - return ERR_PTR(PTR_ERR(exp));
  1227 + return ERR_CAST(exp);
1228 1228 return exp;
1229 1229 }
1230 1230  
... ... @@ -341,11 +341,11 @@
341 341 char *tmp = getname(special);
342 342  
343 343 if (IS_ERR(tmp))
344   - return ERR_PTR(PTR_ERR(tmp));
  344 + return ERR_CAST(tmp);
345 345 bdev = lookup_bdev(tmp);
346 346 putname(tmp);
347 347 if (IS_ERR(bdev))
348   - return ERR_PTR(PTR_ERR(bdev));
  348 + return ERR_CAST(bdev);
349 349 sb = get_super(bdev);
350 350 bdput(bdev);
351 351 if (!sb)
... ... @@ -1536,7 +1536,7 @@
1536 1536 if (!inode)
1537 1537 inode = ERR_PTR(-ESTALE);
1538 1538 if (IS_ERR(inode))
1539   - return ERR_PTR(PTR_ERR(inode));
  1539 + return ERR_CAST(inode);
1540 1540 result = d_alloc_anon(inode);
1541 1541 if (!result) {
1542 1542 iput(inode);
... ... @@ -155,7 +155,7 @@
155 155  
156 156 xadir = open_xa_dir(inode, flags);
157 157 if (IS_ERR(xadir)) {
158   - return ERR_PTR(PTR_ERR(xadir));
  158 + return ERR_CAST(xadir);
159 159 } else if (xadir && !xadir->d_inode) {
160 160 dput(xadir);
161 161 return ERR_PTR(-ENODATA);
... ... @@ -164,7 +164,7 @@
164 164 xafile = lookup_one_len(name, xadir, strlen(name));
165 165 if (IS_ERR(xafile)) {
166 166 dput(xadir);
167   - return ERR_PTR(PTR_ERR(xafile));
  167 + return ERR_CAST(xafile);
168 168 }
169 169  
170 170 if (xafile->d_inode) { /* file exists */
... ... @@ -705,7 +705,7 @@
705 705 brelse(sinfo.bh);
706 706 if (IS_ERR(inode)) {
707 707 unlock_kernel();
708   - return ERR_PTR(PTR_ERR(inode));
  708 + return ERR_CAST(inode);
709 709 }
710 710 alias = d_find_alias(inode);
711 711 if (alias) {
net/rxrpc/af_rxrpc.c
... ... @@ -239,7 +239,7 @@
239 239 /* find a remote transport endpoint from the local one */
240 240 peer = rxrpc_get_peer(srx, gfp);
241 241 if (IS_ERR(peer))
242   - return ERR_PTR(PTR_ERR(peer));
  242 + return ERR_CAST(peer);
243 243  
244 244 /* find a transport */
245 245 trans = rxrpc_get_transport(rx->local, peer, gfp);
... ... @@ -282,7 +282,7 @@
282 282 trans = rxrpc_name_to_transport(sock, (struct sockaddr *) srx,
283 283 sizeof(*srx), 0, gfp);
284 284 if (IS_ERR(trans)) {
285   - call = ERR_PTR(PTR_ERR(trans));
  285 + call = ERR_CAST(trans);
286 286 trans = NULL;
287 287 goto out;
288 288 }
... ... @@ -306,7 +306,7 @@
306 306  
307 307 bundle = rxrpc_get_bundle(rx, trans, key, service_id, gfp);
308 308 if (IS_ERR(bundle)) {
309   - call = ERR_PTR(PTR_ERR(bundle));
  309 + call = ERR_CAST(bundle);
310 310 goto out;
311 311 }
312 312  
... ... @@ -820,7 +820,7 @@
820 820 key = key_alloc(ktype, description, current->fsuid, current->fsgid,
821 821 current, perm, flags);
822 822 if (IS_ERR(key)) {
823   - key_ref = ERR_PTR(PTR_ERR(key));
  823 + key_ref = ERR_CAST(key);
824 824 goto error_3;
825 825 }
826 826  
security/keys/process_keys.c
... ... @@ -660,7 +660,7 @@
660 660  
661 661 key = key_lookup(id);
662 662 if (IS_ERR(key)) {
663   - key_ref = ERR_PTR(PTR_ERR(key));
  663 + key_ref = ERR_CAST(key);
664 664 goto error;
665 665 }
666 666  
security/keys/request_key.c
... ... @@ -389,7 +389,7 @@
389 389 if (!IS_ERR(key_ref)) {
390 390 key = key_ref_to_ptr(key_ref);
391 391 } else if (PTR_ERR(key_ref) != -EAGAIN) {
392   - key = ERR_PTR(PTR_ERR(key_ref));
  392 + key = ERR_CAST(key_ref);
393 393 } else {
394 394 /* the search failed, but the keyrings were searchable, so we
395 395 * should consult userspace if we can */
security/keys/request_key_auth.c
... ... @@ -261,7 +261,7 @@
261 261 current);
262 262  
263 263 if (IS_ERR(authkey_ref)) {
264   - authkey = ERR_PTR(PTR_ERR(authkey_ref));
  264 + authkey = ERR_CAST(authkey_ref);
265 265 goto error;
266 266 }
267 267