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>
This commit is contained in:
Gabriel Krisman Bertazi 2020-01-06 13:58:16 -05:00 коммит произвёл Martin K. Petersen
Родитель 7c1ef33870
Коммит cd7ea70bb0
2 изменённых файлов: 11 добавлений и 6 удалений

Просмотреть файл

@ -30,6 +30,10 @@
#include <linux/attribute_container.h> #include <linux/attribute_container.h>
#include <linux/transport_class.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 * 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 * routine is simply a trigger point used to add the device to the
* system and register attributes for it. * system and register attributes for it.
*/ */
int transport_add_device(struct device *dev)
void 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); EXPORT_SYMBOL_GPL(transport_add_device);

Просмотреть файл

@ -62,16 +62,16 @@ struct transport_container {
container_of(x, struct transport_container, ac) container_of(x, struct transport_container, ac)
void transport_remove_device(struct device *); void transport_remove_device(struct device *);
void transport_add_device(struct device *); int transport_add_device(struct device *);
void transport_setup_device(struct device *); void transport_setup_device(struct device *);
void transport_configure_device(struct device *); void transport_configure_device(struct device *);
void transport_destroy_device(struct device *); void transport_destroy_device(struct device *);
static inline void static inline int
transport_register_device(struct device *dev) transport_register_device(struct device *dev)
{ {
transport_setup_device(dev); transport_setup_device(dev);
transport_add_device(dev); return transport_add_device(dev);
} }
static inline void static inline void