diff options
-rw-r--r-- | drivers/block/null_blk_main.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c index 80d3dcb8722c..d21c82c8863f 100644 --- a/drivers/block/null_blk_main.c +++ b/drivers/block/null_blk_main.c @@ -1469,7 +1469,12 @@ static const struct blk_mq_ops null_mq_ops = { static void null_del_dev(struct nullb *nullb) { - struct nullb_device *dev = nullb->dev; + struct nullb_device *dev; + + if (!nullb) + return; + + dev = nullb->dev; ida_simple_remove(&nullb_indexes, nullb->index); |