Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

driver core: attribute_container: change return type to void

attribute_container_register() has always returned 0 since its
introduction in commit 06ff5a987e ("Add attribute container to generic
device model") in the historical Linux tree [1]. Convert the return type
to void and update all callers.

This removes dead code where callers checked for errors that could never
occur.

Link: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git [1]

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
Link: https://patch.msgid.link/20251220-dev-attribute-container-linux-scsi-v1-1-d58fcd03bf21@samsung.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Daniel Gomez and committed by
Greg Kroah-Hartman
7a96ccc8 5f62af9f

+8 -14
+1 -3
drivers/base/attribute_container.c
··· 69 69 * @cont: The container to register. This must be allocated by the 70 70 * callee and should also be zeroed by it. 71 71 */ 72 - int 72 + void 73 73 attribute_container_register(struct attribute_container *cont) 74 74 { 75 75 INIT_LIST_HEAD(&cont->node); ··· 79 79 mutex_lock(&attribute_container_mutex); 80 80 list_add_tail(&cont->node, &attribute_container_list); 81 81 mutex_unlock(&attribute_container_mutex); 82 - 83 - return 0; 84 82 } 85 83 EXPORT_SYMBOL_GPL(attribute_container_register); 86 84
+2 -6
drivers/base/transport_class.c
··· 88 88 * events. Use prezero and then use DECLARE_ANON_TRANSPORT_CLASS() to 89 89 * initialise the anon transport class storage. 90 90 */ 91 - int anon_transport_class_register(struct anon_transport_class *atc) 91 + void anon_transport_class_register(struct anon_transport_class *atc) 92 92 { 93 - int error; 94 93 atc->container.class = &atc->tclass.class; 95 94 attribute_container_set_no_classdevs(&atc->container); 96 - error = attribute_container_register(&atc->container); 97 - if (error) 98 - return error; 95 + attribute_container_register(&atc->container); 99 96 atc->tclass.setup = anon_transport_dummy_function; 100 97 atc->tclass.remove = anon_transport_dummy_function; 101 - return 0; 102 98 } 103 99 EXPORT_SYMBOL_GPL(anon_transport_class_register); 104 100
+1 -1
drivers/scsi/scsi_transport_spi.c
··· 1622 1622 error = transport_class_register(&spi_transport_class); 1623 1623 if (error) 1624 1624 return error; 1625 - error = anon_transport_class_register(&spi_device_class); 1625 + anon_transport_class_register(&spi_device_class); 1626 1626 return transport_class_register(&spi_host_class); 1627 1627 } 1628 1628
+1 -1
include/linux/attribute_container.h
··· 36 36 atc->flags |= ATTRIBUTE_CONTAINER_NO_CLASSDEVS; 37 37 } 38 38 39 - int attribute_container_register(struct attribute_container *cont); 39 + void attribute_container_register(struct attribute_container *cont); 40 40 int __must_check attribute_container_unregister(struct attribute_container *cont); 41 41 void attribute_container_create_device(struct device *dev, 42 42 int (*fn)(struct attribute_container *,
+3 -3
include/linux/transport_class.h
··· 87 87 transport_destroy_device(dev); 88 88 } 89 89 90 - static inline int transport_container_register(struct transport_container *tc) 90 + static inline void transport_container_register(struct transport_container *tc) 91 91 { 92 - return attribute_container_register(&tc->ac); 92 + attribute_container_register(&tc->ac); 93 93 } 94 94 95 95 static inline void transport_container_unregister(struct transport_container *tc) ··· 99 99 } 100 100 101 101 int transport_class_register(struct transport_class *); 102 - int anon_transport_class_register(struct anon_transport_class *); 102 + void anon_transport_class_register(struct anon_transport_class *); 103 103 void transport_class_unregister(struct transport_class *); 104 104 void anon_transport_class_unregister(struct anon_transport_class *); 105 105