[Skiboot] [PATCH 5/9] blocklevel: smart_write: Avoid indirectly testing formal parameters

Andrew Jeffery andrew at aj.id.au
Thu Oct 3 15:53:38 AEST 2019


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 <andrew at aj.id.au>
---
 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;
 	}
-- 
2.20.1



More information about the Skiboot mailing list