aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index e58d61d9f31b..fe0137a5b002 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -805,7 +805,11 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev)
805 if (fixdesc & (1<<rdev2->desc_nr)) { 805 if (fixdesc & (1<<rdev2->desc_nr)) {
806 snprintf(rdev2->kobj.name, KOBJ_NAME_LEN, "dev%d", 806 snprintf(rdev2->kobj.name, KOBJ_NAME_LEN, "dev%d",
807 rdev2->desc_nr); 807 rdev2->desc_nr);
808 /* kobject_add gets a ref on the parent, so
809 * we have to drop the one we already have
810 */
808 kobject_add(&rdev2->kobj); 811 kobject_add(&rdev2->kobj);
812 kobject_put(rdev->kobj.parent);
809 sysfs_create_link(&rdev2->kobj, 813 sysfs_create_link(&rdev2->kobj,
810 &rdev2->bdev->bd_disk->kobj, 814 &rdev2->bdev->bd_disk->kobj,
811 "block"); 815 "block");
@@ -1178,7 +1182,7 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
1178 1182
1179 rdev->kobj.k_name = NULL; 1183 rdev->kobj.k_name = NULL;
1180 snprintf(rdev->kobj.name, KOBJ_NAME_LEN, "dev%d", rdev->desc_nr); 1184 snprintf(rdev->kobj.name, KOBJ_NAME_LEN, "dev%d", rdev->desc_nr);
1181 rdev->kobj.parent = kobject_get(&mddev->kobj); 1185 rdev->kobj.parent = &mddev->kobj;
1182 kobject_add(&rdev->kobj); 1186 kobject_add(&rdev->kobj);
1183 1187
1184 sysfs_create_link(&rdev->kobj, &rdev->bdev->bd_disk->kobj, "block"); 1188 sysfs_create_link(&rdev->kobj, &rdev->bdev->bd_disk->kobj, "block");
@@ -1864,7 +1868,7 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data)
1864 add_disk(disk); 1868 add_disk(disk);
1865 mddev->gendisk = disk; 1869 mddev->gendisk = disk;
1866 up(&disks_sem); 1870 up(&disks_sem);
1867 mddev->kobj.parent = kobject_get(&disk->kobj); 1871 mddev->kobj.parent = &disk->kobj;
1868 mddev->kobj.k_name = NULL; 1872 mddev->kobj.k_name = NULL;
1869 snprintf(mddev->kobj.name, KOBJ_NAME_LEN, "%s", "md"); 1873 snprintf(mddev->kobj.name, KOBJ_NAME_LEN, "%s", "md");
1870 mddev->kobj.ktype = &md_ktype; 1874 mddev->kobj.ktype = &md_ktype;