]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
scsi: core: raid_class: Remove raid_component_add()
authorZhu Wang <wangzhu9@huawei.com>
Tue, 22 Aug 2023 01:52:54 +0000 (01:52 +0000)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 30 Oct 2023 11:00:29 +0000 (12:00 +0100)
BugLink: https://bugs.launchpad.net/bugs/2039742
commit 60c5fd2e8f3c42a5abc565ba9876ead1da5ad2b7 upstream.

The raid_component_add() function was added to the kernel tree via patch
"[SCSI] embryonic RAID class" (2005). Remove this function since it never
has had any callers in the Linux kernel. And also raid_component_release()
is only used in raid_component_add(), so it is also removed.

Signed-off-by: Zhu Wang <wangzhu9@huawei.com>
Link: https://lore.kernel.org/r/20230822015254.184270-1-wangzhu9@huawei.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Fixes: 04b5b5cb0136 ("scsi: core: Fix possible memory leak if device_add() fails")
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/scsi/raid_class.c
include/linux/raid_class.h

index 711252e52d8e1f08d65c0801d4c53f70182d0134..95a86e0dfd77a8006c40cd6ea0ce361fa77b794b 100644 (file)
@@ -209,54 +209,6 @@ raid_attr_ro_state(level);
 raid_attr_ro_fn(resync);
 raid_attr_ro_state_fn(state);
 
-static void raid_component_release(struct device *dev)
-{
-       struct raid_component *rc =
-               container_of(dev, struct raid_component, dev);
-       dev_printk(KERN_ERR, rc->dev.parent, "COMPONENT RELEASE\n");
-       put_device(rc->dev.parent);
-       kfree(rc);
-}
-
-int raid_component_add(struct raid_template *r,struct device *raid_dev,
-                      struct device *component_dev)
-{
-       struct device *cdev =
-               attribute_container_find_class_device(&r->raid_attrs.ac,
-                                                     raid_dev);
-       struct raid_component *rc;
-       struct raid_data *rd = dev_get_drvdata(cdev);
-       int err;
-
-       rc = kzalloc(sizeof(*rc), GFP_KERNEL);
-       if (!rc)
-               return -ENOMEM;
-
-       INIT_LIST_HEAD(&rc->node);
-       device_initialize(&rc->dev);
-       rc->dev.release = raid_component_release;
-       rc->dev.parent = get_device(component_dev);
-       rc->num = rd->component_count++;
-
-       dev_set_name(&rc->dev, "component-%d", rc->num);
-       list_add_tail(&rc->node, &rd->component_list);
-       rc->dev.class = &raid_class.class;
-       err = device_add(&rc->dev);
-       if (err)
-               goto err_out;
-
-       return 0;
-
-err_out:
-       put_device(&rc->dev);
-       list_del(&rc->node);
-       rd->component_count--;
-       put_device(component_dev);
-       kfree(rc);
-       return err;
-}
-EXPORT_SYMBOL(raid_component_add);
-
 struct raid_template *
 raid_class_attach(struct raid_function_template *ft)
 {
index 5cdfcb873a8f0e8b57c265826a639d7264b60804..772d45b2a60a02143c0fdaeeb9f5b6da372b5448 100644 (file)
@@ -77,7 +77,3 @@ DEFINE_RAID_ATTRIBUTE(enum raid_state, state)
        
 struct raid_template *raid_class_attach(struct raid_function_template *);
 void raid_class_release(struct raid_template *);
-
-int __must_check raid_component_add(struct raid_template *, struct device *,
-                                   struct device *);
-