Content-Type: multipart/mixed; boundary="===============5456460098215077206==" MIME-Version: 1.0 From: ramesh.thomas at intel.com Subject: [Accel-config] [PATCH v1 2/5] accel-config: static analysis bug fix Date: Fri, 04 Dec 2020 15:50:29 -0500 Message-ID: <20201204205031.310835-3-ramesh.thomas@intel.com> In-Reply-To: 20201204205031.310835-1-ramesh.thomas@intel.com To: accel-config@lists.01.org List-ID: --===============5456460098215077206== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Ramesh Thomas Move dereferencing of device after the null check. Signed-off-by: Ramesh Thomas --- 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 *w= q_base, { struct accfg_wq *wq; struct accfg_device *device =3D parent; - struct accfg_group *group =3D 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 *w= q_base, if (!device) return NULL; = + group =3D device->group; ctx =3D accfg_device_get_ctx(device); dfd =3D open(wq_base, O_PATH); if (dfd < 0) -- = 2.26.2 --===============5456460098215077206==--