[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220307094158.404882-1-wanjiabing@vivo.com>
Date: Mon, 7 Mar 2022 17:41:48 +0800
From: Wan Jiabing <wanjiabing@...o.com>
To: Alison Schofield <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Ira Weiny <ira.weiny@...el.com>,
Ben Widawsky <ben.widawsky@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
linux-cxl@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: kael_w@...com, Wan Jiabing <wanjiabing@...o.com>
Subject: [PATCH] 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.
Signed-off-by: Wan Jiabing <wanjiabing@...o.com>
---
drivers/cxl/core/port.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
index d29eb2abdbc2..3349e9f7b89e 100644
--- a/drivers/cxl/core/port.c
+++ b/drivers/cxl/core/port.c
@@ -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;
}
--
2.35.1
Powered by blists - more mailing lists