]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
[SCSI] target: iblock/pscsi claim checking for NULL instead of IS_ERR
authorDan Carpenter <error27@gmail.com>
Wed, 9 Feb 2011 23:34:36 +0000 (15:34 -0800)
committerJames Bottomley <James.Bottomley@suse.de>
Sat, 12 Feb 2011 17:29:07 +0000 (11:29 -0600)
blkdev_get_by_path() returns an ERR_PTR() or error and it doesn't return
a NULL.  It looks like this bug would be easy to trigger by mistake.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/target/target_core_iblock.c
drivers/target/target_core_pscsi.c

index c6e0d757e76e0ecfe8fd7707d58c5167813cf3f3..34561350d5e86907361115b4f02da7128b499a56 100644 (file)
@@ -154,7 +154,7 @@ static struct se_device *iblock_create_virtdevice(
 
        bd = blkdev_get_by_path(ib_dev->ibd_udev_path,
                                FMODE_WRITE|FMODE_READ|FMODE_EXCL, ib_dev);
-       if (!(bd))
+       if (IS_ERR(bd))
                goto failed;
        /*
         * Setup the local scope queue_limits from struct request_queue->limits
index 742d24609a9b26e1337aacf5c67dde199c399f0b..f2a08477a68c66a326b7b65594d7b8f24ab1e6a6 100644 (file)
@@ -462,8 +462,8 @@ static struct se_device *pscsi_create_type_disk(
         */
        bd = blkdev_get_by_path(se_dev->se_dev_udev_path,
                                FMODE_WRITE|FMODE_READ|FMODE_EXCL, pdv);
-       if (!(bd)) {
-               printk("pSCSI: blkdev_get_by_path() failed\n");
+       if (IS_ERR(bd)) {
+               printk(KERN_ERR "pSCSI: blkdev_get_by_path() failed\n");
                scsi_device_put(sd);
                return NULL;
        }