Commit 49d6e658 authored by Dan Carpenter's avatar Dan Carpenter Committed by Dave Jiang
Browse files

cxl/region: Fix an ERR_PTR() vs NULL bug



The __cxl_decoder_detach() function is expected to return NULL on error
but this error path accidentally returns an error pointer.  It could
potentially lead to an error pointer dereference in the caller.  Change
it to return NULL.

Fixes: b3a88225 ("cxl/region: Consolidate cxl_decoder_kill_region() and cxl_region_detach()")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/7def7da0-326a-410d-8c92-718c8963c0a2@sabinyo.mountain


Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
parent 3796f298
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2108,7 +2108,7 @@ __cxl_decoder_detach(struct cxl_region *cxlr,
		if (pos >= p->interleave_ways) {
			dev_dbg(&cxlr->dev, "position %d out of range %d\n",
				pos, p->interleave_ways);
			return ERR_PTR(-ENXIO);
			return NULL;
		}

		if (!p->targets[pos])