diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c index 80d3dcb8722c8784b2bde2af77e941d86f056df5..d21c82c8863f164f5a1e8188f4d5ce8f55a1957a 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);