Skip to contentSkip to conversation

uio_hv_generic: add missed sysfs_remove_bin_file

PATCH In review Chuhong Yuan 2 participants 2 messages May 7, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uio_hv_generic: add missed sysfs_remove_bin_file

This driver calls sysfs_create_bin_file() in probe, but forgets to call sysfs_remove_bin_file() in remove.
Add the missed call to fix it.

---
 drivers/uio/uio_hv_generic.c | 1 +
 1 file changed, 1 insertion(+)
drivers/uio/uio_hv_generic.c +1 -0
index 3c5169eb23f5..4dae2320b103 100644
@@ -361,6 +361,7 @@ hv_uio_remove(struct hv_device *dev)
 	if (!pdata)
 		return 0;
 
+	sysfs_remove_bin_file(&dev->channel->kobj, &ring_buffer_bin_attr);
 	uio_unregister_device(&pdata->info);
 	hv_uio_cleanup(dev, pdata);
 	hv_set_drvdata(dev, NULL);
Signature · 1 line
2.26.2
#1 lore raw
Quoted 14 lines · Chuhong Yuan

This driver calls sysfs_create_bin_file() in probe, but forgets to call sysfs_remove_bin_file() in remove.
Add the missed call to fix it.

---
 drivers/uio/uio_hv_generic.c | 1 +
 1 file changed, 1 insertion(+)
drivers/uio/uio_hv_generic.c +0 -0
index 3c5169eb23f5..4dae2320b103 100644

drivers/uio/uio_hv_generic.c hv_uio_remove(struct hv_device *dev) · line 367

Quoted 7 lines
drivers/uio/uio_hv_generic.c +1 -0
@@ -361,6 +361,7 @@ hv_uio_remove(struct hv_device *dev)
 	if (!pdata)
 		return 0;
 
+	sysfs_remove_bin_file(&dev->channel->kobj, &ring_buffer_bin_attr);
 	uio_unregister_device(&pdata->info);
 	hv_uio_cleanup(dev, pdata);
 	hv_set_drvdata(dev, NULL);

I'll take this, but it's not always needed as all sysfs files are removed from the device when it is removed from sysfs anyway. So this shouldn't be an issue in a real system.

thanks,

greg k-h