The transport registration may fail. Make sure the errors are propagated to the callers.
Unified · Split
| @@ -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 | ||
| 33 | static 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 class | 38 | * 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 the | 176 | * 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 | 179 | int transport_add_device(struct device *dev) | |
| 176 | void 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 | } |
| 180 | EXPORT_SYMBOL_GPL(transport_add_device); | 185 | EXPORT_SYMBOL_GPL(transport_add_device); |
| 181 | 186 | ||
| @@ -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 | ||
| 64 | void transport_remove_device(struct device *); | 64 | void transport_remove_device(struct device *); |
| 65 | void transport_add_device(struct device *); | 65 | int transport_add_device(struct device *); |
| 66 | void transport_setup_device(struct device *); | 66 | void transport_setup_device(struct device *); |
| 67 | void transport_configure_device(struct device *); | 67 | void transport_configure_device(struct device *); |
| 68 | void transport_destroy_device(struct device *); | 68 | void transport_destroy_device(struct device *); |
| 69 | 69 | ||
| 70 | static inline void | 70 | static inline int |
| 71 | transport_register_device(struct device *dev) | 71 | transport_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 | ||
| 77 | static inline void | 77 | static inline void |