Fixup initialisation oops for anonymous transport classes
Subsystems (2)
PATCH 2/8 Fixup initialisation oops for anonymous transport classes
Anonymous transport classes might call transport_add_class_devices with NULL classdev.
Signed-off-by Hannes Reinecke <[email protected]>
--- drivers/base/transport_class.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/base/transport_class.c +7 -1
@@ -150,10 +150,16 @@ static int transport_add_class_device(struct attribute_container *cont,struct device *dev, struct device *classdev) { - int error = attribute_container_add_class_device(classdev); + int error;struct transport_container *tcont =attribute_container_to_transport_container (cont); +/* NULL if called from anonymous transport classes */ +if (!classdev) +return 0 ; + + error =attribute_container_add_class_device (classdev); +if (!error && tcont->statistics) error =sysfs_create_group (&classdev->kobj, tcont->statistics);
Signature · 1 line
1.5.2.4
James Bottomley
maintainerQuoted 2 lines · Hannes Reinecke
Anonymous transport classes might call
transport_add_class_deviceswith NULL classdev.
They do ... but it doesn't cause an oops. class_device_add first calls class_device_get() which returns -EINVAL for a NULL classdev. It looks like device_add() does exactly the same thing in the new scheme, so what oops were you seeing?
James