Skip to contentSkip to conversation

cxl/core/port: fix NULL but dereferenced coccicheck error

PATCH Applied Wan Jiabing 2 participants 2 messages Mar 7, 2022 – Mar 22, 2022 CXL

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cxl/core/port: fix NULL but dereferenced coccicheck error

Fix the following coccicheck warning:
./drivers/cxl/core/port.c:913:21-24: ERROR: port is NULL but dereferenced.

---
 drivers/cxl/core/port.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/cxl/core/port.c +4 -1
index d29eb2abdbc2..3349e9f7b89e 100644
@@ -909,7 +909,10 @@ static void cxl_detach_ep(void *data)
 			break;
 
 		port = find_cxl_port(dport_dev);
-		if (!port || is_cxl_root(port)) {
+		if (!port)
+			continue;
+
+		if (is_cxl_root(port)) {
 			put_device(&port->dev);
 			continue;
 		}
Signature · 1 line
2.35.1