Skip to content

Commit 60c5fd2

Browse files
PeterZhu789martinkpetersen
authored andcommitted
scsi: core: raid_class: Remove raid_component_add()
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Bart Van Assche <[email protected]> Fixes: 04b5b5c ("scsi: core: Fix possible memory leak if device_add() fails") Signed-off-by: Martin K. Petersen <[email protected]>
1 parent c422fbd commit 60c5fd2

File tree

2 files changed

+0
-52
lines changed

2 files changed

+0
-52
lines changed

drivers/scsi/raid_class.c

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -209,54 +209,6 @@ raid_attr_ro_state(level);
209209
raid_attr_ro_fn(resync);
210210
raid_attr_ro_state_fn(state);
211211

212-
static void raid_component_release(struct device *dev)
213-
{
214-
struct raid_component *rc =
215-
container_of(dev, struct raid_component, dev);
216-
dev_printk(KERN_ERR, rc->dev.parent, "COMPONENT RELEASE\n");
217-
put_device(rc->dev.parent);
218-
kfree(rc);
219-
}
220-
221-
int raid_component_add(struct raid_template *r,struct device *raid_dev,
222-
struct device *component_dev)
223-
{
224-
struct device *cdev =
225-
attribute_container_find_class_device(&r->raid_attrs.ac,
226-
raid_dev);
227-
struct raid_component *rc;
228-
struct raid_data *rd = dev_get_drvdata(cdev);
229-
int err;
230-
231-
rc = kzalloc(sizeof(*rc), GFP_KERNEL);
232-
if (!rc)
233-
return -ENOMEM;
234-
235-
INIT_LIST_HEAD(&rc->node);
236-
device_initialize(&rc->dev);
237-
rc->dev.release = raid_component_release;
238-
rc->dev.parent = get_device(component_dev);
239-
rc->num = rd->component_count++;
240-
241-
dev_set_name(&rc->dev, "component-%d", rc->num);
242-
list_add_tail(&rc->node, &rd->component_list);
243-
rc->dev.class = &raid_class.class;
244-
err = device_add(&rc->dev);
245-
if (err)
246-
goto err_out;
247-
248-
return 0;
249-
250-
err_out:
251-
put_device(&rc->dev);
252-
list_del(&rc->node);
253-
rd->component_count--;
254-
put_device(component_dev);
255-
kfree(rc);
256-
return err;
257-
}
258-
EXPORT_SYMBOL(raid_component_add);
259-
260212
struct raid_template *
261213
raid_class_attach(struct raid_function_template *ft)
262214
{

include/linux/raid_class.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,3 @@ DEFINE_RAID_ATTRIBUTE(enum raid_state, state)
7777

7878
struct raid_template *raid_class_attach(struct raid_function_template *);
7979
void raid_class_release(struct raid_template *);
80-
81-
int __must_check raid_component_add(struct raid_template *, struct device *,
82-
struct device *);
83-

0 commit comments

Comments
 (0)