summaryrefslogtreecommitdiffstats
path: root/fmap.c
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2021-06-07 12:33:53 +0200
committerNico Huber <nico.h@gmx.de>2021-06-09 16:03:30 +0000
commit3bd47524c044168b01e54e772d23c7fa723dc0d5 (patch)
treece8c816c3bb0477afb92ed5a7fc222c68a87057c /fmap.c
parent14c916d3801f0f25913e66a157fc834d76cdffba (diff)
downloadflashrom-3bd47524c044168b01e54e772d23c7fa723dc0d5.tar.gz
flashrom-3bd47524c044168b01e54e772d23c7fa723dc0d5.tar.bz2
flashrom-3bd47524c044168b01e54e772d23c7fa723dc0d5.zip
treewide: Drop most cases of `sizeof(struct ...)`
Spelling out the struct type name hurts readability and introduces opportunities for bugs to happen when the pointer variable type is changed but the corresponding sizeof is (are) not. TEST=`make CONFIG_EVERYTHING=yes CONFIG_JLINK_SPI=no VERSION=none -j` with and without this patch; the flashrom executable does not change. Change-Id: Icc0b60ca6ef9f5ece6ed2a0e03600bb6ccd7dcc6 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/55266 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Diffstat (limited to 'fmap.c')
-rw-r--r--fmap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fmap.c b/fmap.c
index 2f34a5ccf..b18cbf799 100644
--- a/fmap.c
+++ b/fmap.c
@@ -195,7 +195,7 @@ static int fmap_bsearch_rom(struct fmap **fmap_out, struct flashctx *const flash
if (prepare_flash_access(flashctx, true, false, false, false))
return 1;
- fmap = malloc(sizeof(struct fmap));
+ fmap = malloc(sizeof(*fmap));
if (!fmap) {
msg_gerr("Out of memory.\n");
goto _free_ret;