[Accel-config] [PATCH v1 5/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 dev 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 c321035..3b53be3 100644
--- a/accfg/lib/libaccfg.c
+++ b/accfg/lib/libaccfg.c
@@ -1110,12 +1110,13 @@ ACCFG_EXPORT int accfg_device_get_clients(struct accfg_device *device)
ACCFG_EXPORT int accfg_device_set_token_limit(struct accfg_device *dev, int val)
{
struct accfg_ctx *ctx;
- char *path = dev->device_buf;
+ char *path;
char buf[SYSFS_ATTR_SIZE];
if (!dev)
return -EINVAL;
+ path = dev->device_buf;
ctx = accfg_device_get_ctx(dev);
if (sprintf(path, "%s/token_limit", dev->device_path) >=
--
2.26.2