Message ID | 20210829171553.532596-1-colin.king@canonical.com |
---|---|
State | New, archived |
Headers | show |
Series | [next] cxl/core: Fix a deference of a pointer cxl_port before it is null checked | expand |
diff --git a/drivers/cxl/core/bus.c b/drivers/cxl/core/bus.c index 0b85351be6bf..55db46ba8a18 100644 --- a/drivers/cxl/core/bus.c +++ b/drivers/cxl/core/bus.c @@ -494,7 +494,7 @@ EXPORT_SYMBOL_GPL(cxl_decoder_alloc); int devm_cxl_add_decoder(struct device *host, struct cxl_decoder *cxld, int *target_map) { - struct cxl_port *port = to_cxl_port(cxld->dev.parent); + struct cxl_port *port; struct device *dev; int rc = 0, i; @@ -509,6 +509,7 @@ int devm_cxl_add_decoder(struct device *host, struct cxl_decoder *cxld, goto err; } + port = to_cxl_port(cxld->dev.parent); device_lock(&port->dev); if (list_empty(&port->dports)) rc = -EINVAL;