mutex_lock(&block_class_lock);
dev = class_find_device(&block_class, NULL, &k, find_start);
- if (dev)
+ if (dev) {
+ put_device(dev);
return dev_to_disk(dev);
+ }
return NULL;
}
struct device *dev;
++*pos;
dev = class_find_device(&block_class, &gp->dev, NULL, find_next);
- if (dev)
+ if (dev) {
+ put_device(dev);
return dev_to_disk(dev);
+ }
return NULL;
}
mutex_lock(&block_class_lock);
dev = class_find_device(&block_class, NULL, &k, find_start);
- if (dev)
+ if (dev) {
+ put_device(dev);
return dev_to_disk(dev);
+ }
return NULL;
}
++*pos;
dev = class_find_device(&block_class, &gp->dev, NULL, find_next);
- if (dev)
+ if (dev) {
+ put_device(dev);
return dev_to_disk(dev);
+ }
return NULL;
}
mutex_lock(&block_class_lock);
find.name = name;
find.part = part;
- dev = class_find_device(&block_class, NULL, (void *)&find, match_id);
- if (dev)
+ dev = class_find_device(&block_class, NULL, &find, match_id);
+ if (dev) {
+ put_device(dev);
devt = MKDEV(MAJOR(dev->devt),
MINOR(dev->devt) + part);
+ }
mutex_unlock(&block_class_lock);
return devt;