|
|
@@ -743,6 +743,7 @@ static void enumerate_services(struct tb_xdomain *xd)
|
|
|
struct tb_service *svc;
|
|
|
struct tb_property *p;
|
|
|
struct device *dev;
|
|
|
+ int id;
|
|
|
|
|
|
/*
|
|
|
* First remove all services that are not available anymore in
|
|
|
@@ -771,7 +772,12 @@ static void enumerate_services(struct tb_xdomain *xd)
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- svc->id = ida_simple_get(&xd->service_ids, 0, 0, GFP_KERNEL);
|
|
|
+ id = ida_simple_get(&xd->service_ids, 0, 0, GFP_KERNEL);
|
|
|
+ if (id < 0) {
|
|
|
+ kfree(svc);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ svc->id = id;
|
|
|
svc->dev.bus = &tb_bus_type;
|
|
|
svc->dev.type = &tb_service_type;
|
|
|
svc->dev.parent = &xd->dev;
|