@@ -182,6 +182,7 @@ static void cxl_decoder_release(struct device *dev)
ida_free(&port->decoder_ida, cxld->id);
kfree(cxld);
+ put_device(&port->dev);
}
static const struct device_type cxl_decoder_switch_type = {
@@ -500,7 +501,10 @@ struct cxl_decoder *cxl_decoder_alloc(struct cxl_port *port, int nr_targets)
if (rc < 0)
goto err;
+ /* need parent to stick around to release the id */
+ get_device(&port->dev);
cxld->id = rc;
+
cxld->nr_targets = nr_targets;
dev = &cxld->dev;
device_initialize(dev);