From 6867bd54c21b023b74e924abd6f4c3f1cd9959c2 Mon Sep 17 00:00:00 2001 From: Andrew Jeffery Date: Thu, 3 Oct 2019 15:23:38 +0930 Subject: [PATCH] blocklevel: smart_write: Avoid indirectly testing formal parameters The early-exit tests write_buf, but write_buf is assigned to buf on declaration. Test buf directly instead to avoid unnecessary indirection. Signed-off-by: Andrew Jeffery Signed-off-by: Oliver O'Halloran --- libflash/blocklevel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libflash/blocklevel.c b/libflash/blocklevel.c index f32db3c0d443..a72bed7422ae 100644 --- a/libflash/blocklevel.c +++ b/libflash/blocklevel.c @@ -513,7 +513,7 @@ int blocklevel_smart_write(struct blocklevel_device *bl, uint64_t pos, const voi void *erase_buf; int rc = 0; - if (!write_buf || !bl) { + if (!buf || !bl) { errno = EINVAL; return FLASH_ERR_PARM_ERROR; }