Skip to content

Commit 801678c

Browse files
Hirofumi Nakagawatorvalds
Hirofumi Nakagawa
authored andcommitted
Remove duplicated unlikely() in IS_ERR()
Some drivers have duplicated unlikely() macros. IS_ERR() already has unlikely() in itself. This patch cleans up such pointless code. Signed-off-by: Hirofumi Nakagawa <hnakagawa@miraclelinux.com> Acked-by: David S. Miller <davem@davemloft.net> Acked-by: Jeff Garzik <jeff@garzik.org> Cc: Paul Clements <paul.clements@steeleye.com> Cc: Richard Purdie <rpurdie@rpsys.net> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: David Brownell <david-b@pacbell.net> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Cc: Michael Halcrow <mhalcrow@us.ibm.com> Cc: Anton Altaparmakov <aia21@cantab.net> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Carsten Otte <cotte@de.ibm.com> Cc: Patrick McHardy <kaber@trash.net> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Jaroslav Kysela <perex@perex.cz> Cc: Takashi Iwai <tiwai@suse.de> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 9a6f70b commit 801678c

File tree

17 files changed

+23
-23
lines changed

17 files changed

+23
-23
lines changed

drivers/block/nbd.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ static struct request *nbd_read_stat(struct nbd_device *lo)
339339
}
340340

341341
req = nbd_find_request(lo, *(struct request **)reply.handle);
342-
if (unlikely(IS_ERR(req))) {
342+
if (IS_ERR(req)) {
343343
result = PTR_ERR(req);
344344
if (result != -ENOENT)
345345
goto harderror;

drivers/leds/led-class.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
105105

106106
led_cdev->dev = device_create(leds_class, parent, 0, "%s",
107107
led_cdev->name);
108-
if (unlikely(IS_ERR(led_cdev->dev)))
108+
if (IS_ERR(led_cdev->dev))
109109
return PTR_ERR(led_cdev->dev);
110110

111111
dev_set_drvdata(led_cdev->dev, led_cdev);

drivers/message/i2o/i2o_block.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ static int i2o_block_prep_req_fn(struct request_queue *q, struct request *req)
371371
/* connect the i2o_block_request to the request */
372372
if (!req->special) {
373373
ireq = i2o_block_request_alloc();
374-
if (unlikely(IS_ERR(ireq))) {
374+
if (IS_ERR(ireq)) {
375375
osm_debug("unable to allocate i2o_block_request!\n");
376376
return BLKPREP_DEFER;
377377
}

drivers/net/myri10ge/myri10ge.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2437,7 +2437,7 @@ static int myri10ge_sw_tso(struct sk_buff *skb, struct net_device *dev)
24372437
int status;
24382438

24392439
segs = skb_gso_segment(skb, dev->features & ~NETIF_F_TSO6);
2440-
if (unlikely(IS_ERR(segs)))
2440+
if (IS_ERR(segs))
24412441
goto drop;
24422442

24432443
while (segs) {

drivers/net/tg3.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -4361,7 +4361,7 @@ static int tg3_tso_bug(struct tg3 *tp, struct sk_buff *skb)
43614361
}
43624362

43634363
segs = skb_gso_segment(skb, tp->dev->features & ~NETIF_F_TSO);
4364-
if (unlikely(IS_ERR(segs)))
4364+
if (IS_ERR(segs))
43654365
goto tg3_tso_bug_end;
43664366

43674367
do {

drivers/rtc/rtc-bfin.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ static int __devinit bfin_rtc_probe(struct platform_device *pdev)
419419
return -ENOMEM;
420420

421421
rtc->rtc_dev = rtc_device_register(pdev->name, &pdev->dev, &bfin_rtc_ops, THIS_MODULE);
422-
if (unlikely(IS_ERR(rtc))) {
422+
if (IS_ERR(rtc)) {
423423
ret = PTR_ERR(rtc->rtc_dev);
424424
goto err;
425425
}

drivers/scsi/scsi_scan.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1828,7 +1828,7 @@ void scsi_scan_host(struct Scsi_Host *shost)
18281828
}
18291829

18301830
p = kthread_run(do_scan_async, data, "scsi_scan_%d", shost->host_no);
1831-
if (unlikely(IS_ERR(p)))
1831+
if (IS_ERR(p))
18321832
do_scan_async(data);
18331833
}
18341834
EXPORT_SYMBOL(scsi_scan_host);

fs/aio.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1604,7 +1604,7 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
16041604
* event using the eventfd_signal() function.
16051605
*/
16061606
req->ki_eventfd = eventfd_fget((int) iocb->aio_resfd);
1607-
if (unlikely(IS_ERR(req->ki_eventfd))) {
1607+
if (IS_ERR(req->ki_eventfd)) {
16081608
ret = PTR_ERR(req->ki_eventfd);
16091609
goto out_put_req;
16101610
}

fs/ecryptfs/inode.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ ecryptfs_do_create(struct inode *directory_inode,
111111

112112
lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry);
113113
lower_dir_dentry = lock_parent(lower_dentry);
114-
if (unlikely(IS_ERR(lower_dir_dentry))) {
114+
if (IS_ERR(lower_dir_dentry)) {
115115
ecryptfs_printk(KERN_ERR, "Error locking directory of "
116116
"dentry\n");
117117
rc = PTR_ERR(lower_dir_dentry);

fs/inotify_user.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ asmlinkage long sys_inotify_init(void)
598598
}
599599

600600
ih = inotify_init(&inotify_user_ops);
601-
if (unlikely(IS_ERR(ih))) {
601+
if (IS_ERR(ih)) {
602602
ret = PTR_ERR(ih);
603603
goto out_free_dev;
604604
}

fs/ntfs/mft.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,7 @@ static int ntfs_mft_bitmap_find_and_alloc_free_rec_nolock(ntfs_volume *vol,
11911191
if (size) {
11921192
page = ntfs_map_page(mftbmp_mapping,
11931193
ofs >> PAGE_CACHE_SHIFT);
1194-
if (unlikely(IS_ERR(page))) {
1194+
if (IS_ERR(page)) {
11951195
ntfs_error(vol->sb, "Failed to read mft "
11961196
"bitmap, aborting.");
11971197
return PTR_ERR(page);
@@ -2118,7 +2118,7 @@ static int ntfs_mft_record_format(const ntfs_volume *vol, const s64 mft_no)
21182118
}
21192119
/* Read, map, and pin the page containing the mft record. */
21202120
page = ntfs_map_page(mft_vi->i_mapping, index);
2121-
if (unlikely(IS_ERR(page))) {
2121+
if (IS_ERR(page)) {
21222122
ntfs_error(vol->sb, "Failed to map page containing mft record "
21232123
"to format 0x%llx.", (long long)mft_no);
21242124
return PTR_ERR(page);
@@ -2519,7 +2519,7 @@ ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, const int mode,
25192519
ofs = (bit << vol->mft_record_size_bits) & ~PAGE_CACHE_MASK;
25202520
/* Read, map, and pin the page containing the mft record. */
25212521
page = ntfs_map_page(vol->mft_ino->i_mapping, index);
2522-
if (unlikely(IS_ERR(page))) {
2522+
if (IS_ERR(page)) {
25232523
ntfs_error(vol->sb, "Failed to map page containing allocated "
25242524
"mft record 0x%llx.", (long long)bit);
25252525
err = PTR_ERR(page);

kernel/auditfilter.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ static int audit_to_watch(struct audit_krule *krule, char *path, int len,
272272
return -EINVAL;
273273

274274
watch = audit_init_watch(path);
275-
if (unlikely(IS_ERR(watch)))
275+
if (IS_ERR(watch))
276276
return PTR_ERR(watch);
277277

278278
audit_get_watch(watch);
@@ -848,7 +848,7 @@ static struct audit_watch *audit_dupe_watch(struct audit_watch *old)
848848
return ERR_PTR(-ENOMEM);
849849

850850
new = audit_init_watch(path);
851-
if (unlikely(IS_ERR(new))) {
851+
if (IS_ERR(new)) {
852852
kfree(path);
853853
goto out;
854854
}
@@ -989,7 +989,7 @@ static void audit_update_watch(struct audit_parent *parent,
989989
audit_set_auditable(current->audit_context);
990990

991991
nwatch = audit_dupe_watch(owatch);
992-
if (unlikely(IS_ERR(nwatch))) {
992+
if (IS_ERR(nwatch)) {
993993
mutex_unlock(&audit_filter_mutex);
994994
audit_panic("error updating watch, skipping");
995995
return;
@@ -1004,7 +1004,7 @@ static void audit_update_watch(struct audit_parent *parent,
10041004
list_del_rcu(&oentry->list);
10051005

10061006
nentry = audit_dupe_rule(&oentry->rule, nwatch);
1007-
if (unlikely(IS_ERR(nentry)))
1007+
if (IS_ERR(nentry))
10081008
audit_panic("error updating watch, removing");
10091009
else {
10101010
int h = audit_hash_ino((u32)ino);
@@ -1785,7 +1785,7 @@ int audit_update_lsm_rules(void)
17851785
watch = entry->rule.watch;
17861786
tree = entry->rule.tree;
17871787
nentry = audit_dupe_rule(&entry->rule, watch);
1788-
if (unlikely(IS_ERR(nentry))) {
1788+
if (IS_ERR(nentry)) {
17891789
/* save the first error encountered for the
17901790
* return value */
17911791
if (!err)

net/core/dev.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,7 @@ static int dev_gso_segment(struct sk_buff *skb)
15241524
if (!segs)
15251525
return 0;
15261526

1527-
if (unlikely(IS_ERR(segs)))
1527+
if (IS_ERR(segs))
15281528
return PTR_ERR(segs);
15291529

15301530
skb->next = segs;

net/ipv4/af_inet.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,7 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb, int features)
12341234
segs = ops->gso_segment(skb, features);
12351235
rcu_read_unlock();
12361236

1237-
if (!segs || unlikely(IS_ERR(segs)))
1237+
if (!segs || IS_ERR(segs))
12381238
goto out;
12391239

12401240
skb = segs;

net/netfilter/nf_queue.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ int nf_queue(struct sk_buff *skb,
214214

215215
segs = skb_gso_segment(skb, 0);
216216
kfree_skb(skb);
217-
if (unlikely(IS_ERR(segs)))
217+
if (IS_ERR(segs))
218218
return 1;
219219

220220
do {

net/xfrm/xfrm_output.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ static int xfrm_output_gso(struct sk_buff *skb)
150150

151151
segs = skb_gso_segment(skb, 0);
152152
kfree_skb(skb);
153-
if (unlikely(IS_ERR(segs)))
153+
if (IS_ERR(segs))
154154
return PTR_ERR(segs);
155155

156156
do {

sound/sh/aica.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ static int __init aica_init(void)
663663
return err;
664664
pd = platform_device_register_simple(SND_AICA_DRIVER, -1,
665665
aica_memory_space, 2);
666-
if (unlikely(IS_ERR(pd))) {
666+
if (IS_ERR(pd)) {
667667
platform_driver_unregister(&snd_aica_driver);
668668
return PTR_ERR(pd);
669669
}

0 commit comments

Comments
 (0)