summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/block/test.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/block/test.c b/drivers/block/test.c
index 66c19a942be8..f72f814131ae 100644
--- a/drivers/block/test.c
+++ b/drivers/block/test.c
@@ -277,7 +277,7 @@ out:
kfree(path);
return ret;
err:
- if (dev && dev->bdev)
+ if (dev && !IS_ERR(dev->bdev))
blkdev_put(dev->bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
kfree(dev);
goto out;