[Accel-config] [PATCH v1 2/5] accel-config: static analysis bug fix

ramesh.thomas at intel.com
Newsgroups dev.linux.lists.accel-config
Message-ID <[email protected]>
From: Ramesh Thomas <ramesh.thomas(a)intel.com>

Move dereferencing of device after the null check.

Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 accfg/lib/libaccfg.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/accfg/lib/libaccfg.c b/accfg/lib/libaccfg.c
index cd9da42..92d3a70 100644
--- a/accfg/lib/libaccfg.c
+++ b/accfg/lib/libaccfg.c
@@ -529,7 +529,7 @@ static void *add_wq(void *parent, int id, const char *wq_base,
 {
 	struct accfg_wq *wq;
 	struct accfg_device *device = parent;
-	struct accfg_group *group = device->group;
+	struct accfg_group *group;
 	struct accfg_ctx *ctx;
 	char *path;
 	char *wq_base_string;
@@ -540,6 +540,7 @@ static void *add_wq(void *parent, int id, const char *wq_base,
 	if (!device)
 		return NULL;
 
+	group = device->group;
 	ctx = accfg_device_get_ctx(device);
 	dfd = open(wq_base, O_PATH);
 	if (dfd < 0)
-- 
2.26.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.