dm: return earlier from dm_blk_ioctl if target doesn't implement .ioctl
authorMike Snitzer <snitzer@redhat.com>
Sun, 16 Nov 2014 19:21:47 +0000 (14:21 -0500)
committerMike Snitzer <snitzer@redhat.com>
Wed, 19 Nov 2014 16:24:56 +0000 (11:24 -0500)
No point checking if the device is suspended if the current target
doesn't even implement .ioctl

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm.c

index 866ff19aa43838e5848bbd4f07d18465489cf1f8..f8cdd97c28a72ffd855260bbeb019e05a2542d02 100644 (file)
@@ -525,14 +525,15 @@ retry:
                goto out;
 
        tgt = dm_table_get_target(map, 0);
+       if (!tgt->type->ioctl)
+               goto out;
 
        if (dm_suspended_md(md)) {
                r = -EAGAIN;
                goto out;
        }
 
-       if (tgt->type->ioctl)
-               r = tgt->type->ioctl(tgt, cmd, arg);
+       r = tgt->type->ioctl(tgt, cmd, arg);
 
 out:
        dm_put_live_table(md, srcu_idx);