Remove duplicated unlikely() in IS_ERR()
authorHirofumi Nakagawa <hnakagawa@miraclelinux.com>
Tue, 29 Apr 2008 08:03:09 +0000 (01:03 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 29 Apr 2008 15:06:25 +0000 (08:06 -0700)
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>
17 files changed:
drivers/block/nbd.c
drivers/leds/led-class.c
drivers/message/i2o/i2o_block.c
drivers/net/myri10ge/myri10ge.c
drivers/net/tg3.c
drivers/rtc/rtc-bfin.c
drivers/scsi/scsi_scan.c
fs/aio.c
fs/ecryptfs/inode.c
fs/inotify_user.c
fs/ntfs/mft.c
kernel/auditfilter.c
net/core/dev.c
net/ipv4/af_inet.c
net/netfilter/nf_queue.c
net/xfrm/xfrm_output.c
sound/sh/aica.c

index a3da198ca429c6de062a80dd6cc5ccae730a8e82..bdba282f15e42eb57968972d6d982d0fd782fd25 100644 (file)
@@ -339,7 +339,7 @@ static struct request *nbd_read_stat(struct nbd_device *lo)
        }
 
        req = nbd_find_request(lo, *(struct request **)reply.handle);
-       if (unlikely(IS_ERR(req))) {
+       if (IS_ERR(req)) {
                result = PTR_ERR(req);
                if (result != -ENOENT)
                        goto harderror;
index ac05a928f7642a54a51a0627e6ca7dc904511d09..b3c54be745568863f8eb5a271ba3e85d4f441f1f 100644 (file)
@@ -105,7 +105,7 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
 
        led_cdev->dev = device_create(leds_class, parent, 0, "%s",
                                            led_cdev->name);
-       if (unlikely(IS_ERR(led_cdev->dev)))
+       if (IS_ERR(led_cdev->dev))
                return PTR_ERR(led_cdev->dev);
 
        dev_set_drvdata(led_cdev->dev, led_cdev);
index a95314897402b53cd7d677e0eff4c8a27966668e..81483de8c0fdfeae0262dc745a1147ca5c28f966 100644 (file)
@@ -371,7 +371,7 @@ static int i2o_block_prep_req_fn(struct request_queue *q, struct request *req)
        /* connect the i2o_block_request to the request */
        if (!req->special) {
                ireq = i2o_block_request_alloc();
-               if (unlikely(IS_ERR(ireq))) {
+               if (IS_ERR(ireq)) {
                        osm_debug("unable to allocate i2o_block_request!\n");
                        return BLKPREP_DEFER;
                }
index cead81e80f0c84dfcc443e0eb1466f09664f0f71..ef63c8d2bd7e4ae550a2f2add91b9327b1e6a40a 100644 (file)
@@ -2437,7 +2437,7 @@ static int myri10ge_sw_tso(struct sk_buff *skb, struct net_device *dev)
        int status;
 
        segs = skb_gso_segment(skb, dev->features & ~NETIF_F_TSO6);
-       if (unlikely(IS_ERR(segs)))
+       if (IS_ERR(segs))
                goto drop;
 
        while (segs) {
index e3f74c9f78bd848f1e61aa6647f7109e7282fd7c..b66c75e3b8a1f6428b4d9f0409e6f611421bb923 100644 (file)
@@ -4361,7 +4361,7 @@ static int tg3_tso_bug(struct tg3 *tp, struct sk_buff *skb)
        }
 
        segs = skb_gso_segment(skb, tp->dev->features & ~NETIF_F_TSO);
-       if (unlikely(IS_ERR(segs)))
+       if (IS_ERR(segs))
                goto tg3_tso_bug_end;
 
        do {
index 4f28045d9ef201706e0aff6f7e330f564c758ab5..8624f55d05608cabe99e6f91a9e18220be699a13 100644 (file)
@@ -419,7 +419,7 @@ static int __devinit bfin_rtc_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        rtc->rtc_dev = rtc_device_register(pdev->name, &pdev->dev, &bfin_rtc_ops, THIS_MODULE);
-       if (unlikely(IS_ERR(rtc))) {
+       if (IS_ERR(rtc)) {
                ret = PTR_ERR(rtc->rtc_dev);
                goto err;
        }
index fcd7455ffc39acf226233c10c3a45c1ee76537e0..a00eee6f7be9fc85d85f3eb4f33516aa22d8689b 100644 (file)
@@ -1828,7 +1828,7 @@ void scsi_scan_host(struct Scsi_Host *shost)
        }
 
        p = kthread_run(do_scan_async, data, "scsi_scan_%d", shost->host_no);
-       if (unlikely(IS_ERR(p)))
+       if (IS_ERR(p))
                do_scan_async(data);
 }
 EXPORT_SYMBOL(scsi_scan_host);
index 81c01290939b93f4898f28efd80c14f78444a958..a175ad650b6649acba97894b294b8e8a72eeb105 100644 (file)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1604,7 +1604,7 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
                 * event using the eventfd_signal() function.
                 */
                req->ki_eventfd = eventfd_fget((int) iocb->aio_resfd);
-               if (unlikely(IS_ERR(req->ki_eventfd))) {
+               if (IS_ERR(req->ki_eventfd)) {
                        ret = PTR_ERR(req->ki_eventfd);
                        goto out_put_req;
                }
index 1623ebf25e5121950c4a4f9dc9edf700988146fe..0a1397335a8eb49a245e81b1826607a5158a2685 100644 (file)
@@ -111,7 +111,7 @@ ecryptfs_do_create(struct inode *directory_inode,
 
        lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry);
        lower_dir_dentry = lock_parent(lower_dentry);
-       if (unlikely(IS_ERR(lower_dir_dentry))) {
+       if (IS_ERR(lower_dir_dentry)) {
                ecryptfs_printk(KERN_ERR, "Error locking directory of "
                                "dentry\n");
                rc = PTR_ERR(lower_dir_dentry);
index 7b94a1e3c015468b30e6343156053fd5e409afca..6676c06bb7c16935b3a7fbc4615836f1dfb256fb 100644 (file)
@@ -598,7 +598,7 @@ asmlinkage long sys_inotify_init(void)
        }
 
        ih = inotify_init(&inotify_user_ops);
-       if (unlikely(IS_ERR(ih))) {
+       if (IS_ERR(ih)) {
                ret = PTR_ERR(ih);
                goto out_free_dev;
        }
index 2ad5c8b104b934c9177e162d2c20c6da211ed0d9..790defb847e71786e8b34358a11ccf5dfe1e0609 100644 (file)
@@ -1191,7 +1191,7 @@ static int ntfs_mft_bitmap_find_and_alloc_free_rec_nolock(ntfs_volume *vol,
                if (size) {
                        page = ntfs_map_page(mftbmp_mapping,
                                        ofs >> PAGE_CACHE_SHIFT);
-                       if (unlikely(IS_ERR(page))) {
+                       if (IS_ERR(page)) {
                                ntfs_error(vol->sb, "Failed to read mft "
                                                "bitmap, aborting.");
                                return PTR_ERR(page);
@@ -2118,7 +2118,7 @@ static int ntfs_mft_record_format(const ntfs_volume *vol, const s64 mft_no)
        }
        /* Read, map, and pin the page containing the mft record. */
        page = ntfs_map_page(mft_vi->i_mapping, index);
-       if (unlikely(IS_ERR(page))) {
+       if (IS_ERR(page)) {
                ntfs_error(vol->sb, "Failed to map page containing mft record "
                                "to format 0x%llx.", (long long)mft_no);
                return PTR_ERR(page);
@@ -2519,7 +2519,7 @@ mft_rec_already_initialized:
        ofs = (bit << vol->mft_record_size_bits) & ~PAGE_CACHE_MASK;
        /* Read, map, and pin the page containing the mft record. */
        page = ntfs_map_page(vol->mft_ino->i_mapping, index);
-       if (unlikely(IS_ERR(page))) {
+       if (IS_ERR(page)) {
                ntfs_error(vol->sb, "Failed to map page containing allocated "
                                "mft record 0x%llx.", (long long)bit);
                err = PTR_ERR(page);
index 28fef6bf85348ea0e363a9ecfc1b362df817656e..13430176b3c92500978f2ea7c19941173d5591d3 100644 (file)
@@ -272,7 +272,7 @@ static int audit_to_watch(struct audit_krule *krule, char *path, int len,
                return -EINVAL;
 
        watch = audit_init_watch(path);
-       if (unlikely(IS_ERR(watch)))
+       if (IS_ERR(watch))
                return PTR_ERR(watch);
 
        audit_get_watch(watch);
@@ -848,7 +848,7 @@ static struct audit_watch *audit_dupe_watch(struct audit_watch *old)
                return ERR_PTR(-ENOMEM);
 
        new = audit_init_watch(path);
-       if (unlikely(IS_ERR(new))) {
+       if (IS_ERR(new)) {
                kfree(path);
                goto out;
        }
@@ -989,7 +989,7 @@ static void audit_update_watch(struct audit_parent *parent,
                        audit_set_auditable(current->audit_context);
 
                nwatch = audit_dupe_watch(owatch);
-               if (unlikely(IS_ERR(nwatch))) {
+               if (IS_ERR(nwatch)) {
                        mutex_unlock(&audit_filter_mutex);
                        audit_panic("error updating watch, skipping");
                        return;
@@ -1004,7 +1004,7 @@ static void audit_update_watch(struct audit_parent *parent,
                        list_del_rcu(&oentry->list);
 
                        nentry = audit_dupe_rule(&oentry->rule, nwatch);
-                       if (unlikely(IS_ERR(nentry)))
+                       if (IS_ERR(nentry))
                                audit_panic("error updating watch, removing");
                        else {
                                int h = audit_hash_ino((u32)ino);
@@ -1785,7 +1785,7 @@ int audit_update_lsm_rules(void)
                        watch = entry->rule.watch;
                        tree = entry->rule.tree;
                        nentry = audit_dupe_rule(&entry->rule, watch);
-                       if (unlikely(IS_ERR(nentry))) {
+                       if (IS_ERR(nentry)) {
                                /* save the first error encountered for the
                                 * return value */
                                if (!err)
index e1df1ab3e04a18d32f9f4aa3fe86e42a9737e3cd..ed49da592051f368cf32b3bafd59bd05494c3c67 100644 (file)
@@ -1524,7 +1524,7 @@ static int dev_gso_segment(struct sk_buff *skb)
        if (!segs)
                return 0;
 
-       if (unlikely(IS_ERR(segs)))
+       if (IS_ERR(segs))
                return PTR_ERR(segs);
 
        skb->next = segs;
index f2b5270efdaaa4e056cff85624662fc853e79775..24eca23c2db3159c91898bd7fefe8bbb501f1233 100644 (file)
@@ -1234,7 +1234,7 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb, int features)
                segs = ops->gso_segment(skb, features);
        rcu_read_unlock();
 
-       if (!segs || unlikely(IS_ERR(segs)))
+       if (!segs || IS_ERR(segs))
                goto out;
 
        skb = segs;
index bbd26893c0c4f7e46d1c312eeaed743b7834f5be..582ec3efc8a55f32603feeca879a8267a2639d6b 100644 (file)
@@ -214,7 +214,7 @@ int nf_queue(struct sk_buff *skb,
 
        segs = skb_gso_segment(skb, 0);
        kfree_skb(skb);
-       if (unlikely(IS_ERR(segs)))
+       if (IS_ERR(segs))
                return 1;
 
        do {
index 2519129c6d213f85bceebc165e2c27744f2fd3b6..09cd9c0c2d805bcac6f742d5a3ef8945502fe223 100644 (file)
@@ -150,7 +150,7 @@ static int xfrm_output_gso(struct sk_buff *skb)
 
        segs = skb_gso_segment(skb, 0);
        kfree_skb(skb);
-       if (unlikely(IS_ERR(segs)))
+       if (IS_ERR(segs))
                return PTR_ERR(segs);
 
        do {
index d49417bf78c693dc115390cd14d6c54d84fd8c7f..9ca1133261437f7f7d630e4e2276b9af9d068e1c 100644 (file)
@@ -663,7 +663,7 @@ static int __init aica_init(void)
                return err;
        pd = platform_device_register_simple(SND_AICA_DRIVER, -1,
                                             aica_memory_space, 2);
-       if (unlikely(IS_ERR(pd))) {
+       if (IS_ERR(pd)) {
                platform_driver_unregister(&snd_aica_driver);
                return PTR_ERR(pd);
        }