History

scsi: drivers: base: Propagate errors through the transport component

The transport registration may fail. Make sure the errors are propagated to the callers.

Gabriel Krisman Bertazi committed 6 years ago

Commit cd7ea701 parent 7c1ef332 files · +11 −6Browse files

Unified · Split

2 files
  1. drivers/base/transport_class.c +8 −3
  2. include/linux/transport_class.h +3 −3
drivers/base/transport_class.c+8−3
@@ -30,6 +30,10 @@ · 29 unmodified lines
30#include <linux/attribute_container.h>30#include <linux/attribute_container.h>
31#include <linux/transport_class.h>31#include <linux/transport_class.h>
32 32
33static int transport_remove_classdev(struct attribute_container *cont,
34 struct device *dev,
35 struct device *classdev);
36
33/**37/**
34 * transport_class_register - register an initial transport class38 * transport_class_register - register an initial transport class
35 *39 *
@@ -172,10 +176,11 @@ static int transport_add_class_device(struct attribute_container *cont, · 136 unmodified lines
172 * routine is simply a trigger point used to add the device to the176 * routine is simply a trigger point used to add the device to the
173 * system and register attributes for it.177 * system and register attributes for it.
174 */178 */
175 179int transport_add_device(struct device *dev)
176void transport_add_device(struct device *dev)
177{180{
178 attribute_container_device_trigger(dev, transport_add_class_device);181 return attribute_container_device_trigger_safe(dev,
182 transport_add_class_device,
183 transport_remove_classdev);
179}184}
180EXPORT_SYMBOL_GPL(transport_add_device);185EXPORT_SYMBOL_GPL(transport_add_device);
181 186
include/linux/transport_class.h+3−3
@@ -62,16 +62,16 @@ struct transport_container { · 61 unmodified lines
62 container_of(x, struct transport_container, ac)62 container_of(x, struct transport_container, ac)
63 63
64void transport_remove_device(struct device *);64void transport_remove_device(struct device *);
65void transport_add_device(struct device *);65int transport_add_device(struct device *);
66void transport_setup_device(struct device *);66void transport_setup_device(struct device *);
67void transport_configure_device(struct device *);67void transport_configure_device(struct device *);
68void transport_destroy_device(struct device *);68void transport_destroy_device(struct device *);
69 69
70static inline void70static inline int
71transport_register_device(struct device *dev)71transport_register_device(struct device *dev)
72{72{
73 transport_setup_device(dev);73 transport_setup_device(dev);
74 transport_add_device(dev);74 return transport_add_device(dev);
75}75}
76 76
77static inline void77static inline void