Skip to content

Commit

Permalink
blocklevel: smart_write: Avoid indirectly testing formal parameters
Browse files Browse the repository at this point in the history
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@aj.id.au>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
  • Loading branch information
amboar authored and oohal committed Oct 14, 2019
1 parent 518db2b commit 6867bd5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libflash/blocklevel.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit 6867bd5

Please sign in to comment.