lkml.org 
[lkml]   [2022]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] cxl/core/port: fix NULL but dereferenced coccicheck error
Date
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@vivo.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
\
 
 \ /
  Last update: 2022-03-07 11:12    [W:0.272 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site