diff --git a/block/bsg.c b/block/bsg.c index f0b7cd3432160203ea6c650088ccfcd4acf2a3f6..54d617f7df3e03b3aa02def2473b03ad66a5d39b 100644 --- a/block/bsg.c +++ b/block/bsg.c @@ -709,11 +709,12 @@ static void bsg_kref_release_function(struct kref *kref) { struct bsg_class_device *bcd = container_of(kref, struct bsg_class_device, ref); + struct device *parent = bcd->parent; if (bcd->release) bcd->release(bcd->parent); - put_device(bcd->parent); + put_device(parent); } static int bsg_put_device(struct bsg_device *bd)