Commit 05e81553 authored by Wan Jiabing's avatar Wan Jiabing Committed by Dan Williams

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.

The put_device() is only relevent in the is_cxl_root() case.

Fixes: 2703c16c ("cxl/core/port: Add switch port enumeration")
Signed-off-by: default avatarWan Jiabing <wanjiabing@vivo.com>
Link: https://lore.kernel.org/r/20220307094158.404882-1-wanjiabing@vivo.comSigned-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 74be9877
......@@ -911,7 +911,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;
}
......
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