Content-Type: multipart/mixed; boundary="===============5815378118935108358==" MIME-Version: 1.0 From: ramesh.thomas at intel.com Subject: [Accel-config] [PATCH v1 4/5] accel-config: static analysis bug fix Date: Fri, 04 Dec 2020 15:50:31 -0500 Message-ID: <20201204205031.310835-5-ramesh.thomas@intel.com> In-Reply-To: 20201204205031.310835-1-ramesh.thomas@intel.com To: accel-config@lists.01.org List-ID: --===============5815378118935108358== 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 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 cha= r *engine_base, struct accfg_engine *engine; struct accfg_device *device =3D parent; struct accfg_ctx *ctx; - struct accfg_group *group =3D 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 cha= r *engine_base, if (!device) return NULL; = + group =3D device->group; ctx =3D accfg_device_get_ctx(device); dfd =3D open(engine_base, O_PATH); if (dfd < 0) -- = 2.26.2 --===============5815378118935108358==--