[Accel-config] [PATCH v1 4/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 a3f71ca..c321035 100644 --- a/accfg/lib/libaccfg.c +++ b/accfg/lib/libaccfg.c @@ -715,7 +715,7 @@ static void *add_engine(void *parent, int id, const char *engine_base, struct accfg_engine *engine; struct accfg_device *device = parent; struct accfg_ctx *ctx; - struct accfg_group *group = device->group; + struct accfg_group *group; char *path; char *engine_base_string; int dfd; @@ -724,6 +724,7 @@ static void *add_engine(void *parent, int id, const char *engine_base, if (!device) return NULL; + group = device->group; ctx = accfg_device_get_ctx(device); dfd = open(engine_base, O_PATH); if (dfd < 0) -- 2.26.2