summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorGabriel Krisman Bertazi <krisman@collabora.com>2020-01-06 13:58:16 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2020-01-15 22:55:37 -0500
commitcd7ea70bb00aac8f7ab1b0635edc669e12f53891 (patch)
tree6c25bbfce78677254849f1dc52bd4f506d9b8b64 /drivers/base
parent7c1ef338705fb5c53e6f574ae5eb19fdfacb3d26 (diff)
downloadlinux-cd7ea70bb00aac8f7ab1b0635edc669e12f53891.tar.bz2
scsi: drivers: base: Propagate errors through the transport component
The transport registration may fail. Make sure the errors are propagated to the callers. Link: https://lore.kernel.org/r/20200106185817.640331-3-krisman@collabora.com Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/transport_class.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/base/transport_class.c b/drivers/base/transport_class.c
index 5ed86ded6e6b..ccc86206e508 100644
--- a/drivers/base/transport_class.c
+++ b/drivers/base/transport_class.c
@@ -30,6 +30,10 @@
#include <linux/attribute_container.h>
#include <linux/transport_class.h>
+static int transport_remove_classdev(struct attribute_container *cont,
+ struct device *dev,
+ struct device *classdev);
+
/**
* transport_class_register - register an initial transport class
*
@@ -172,10 +176,11 @@ static int transport_add_class_device(struct attribute_container *cont,
* routine is simply a trigger point used to add the device to the
* system and register attributes for it.
*/
-
-void transport_add_device(struct device *dev)
+int transport_add_device(struct device *dev)
{
- attribute_container_device_trigger(dev, transport_add_class_device);
+ return attribute_container_device_trigger_safe(dev,
+ transport_add_class_device,
+ transport_remove_classdev);
}
EXPORT_SYMBOL_GPL(transport_add_device);