Commit 764d102e authored by Dave Jiang's avatar Dave Jiang Committed by Dan Williams

cxl: Add missing return to cdat read error path

Add a return to the error path when cxl_cdat_read_table() fails. Current
code continues with the table pointer points to freed memory.

Fixes: 7a877c92 ("cxl/pci: Simplify CDAT retrieval error path")
Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
Reviewed-by: default avatarDavidlohr Bueso <dave@stgolabs.net>
Link: https://lore.kernel.org/r/168382793506.3510737.4792518576623749076.stgit@djiang5-mobl3Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 270205be
...@@ -571,6 +571,7 @@ void read_cdat_data(struct cxl_port *port) ...@@ -571,6 +571,7 @@ void read_cdat_data(struct cxl_port *port)
/* Don't leave table data allocated on error */ /* Don't leave table data allocated on error */
devm_kfree(dev, cdat_table); devm_kfree(dev, cdat_table);
dev_err(dev, "CDAT data read error\n"); dev_err(dev, "CDAT data read error\n");
return;
} }
port->cdat.table = cdat_table + sizeof(__le32); port->cdat.table = cdat_table + sizeof(__le32);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment