aboutsummaryrefslogtreecommitdiffstats
path: root/flashrom.c
diff options
context:
space:
mode:
authorFelix Singer <felixsinger@posteo.net>2022-08-19 02:44:28 +0200
committerAnastasia Klimchuk <aklm@chromium.org>2022-09-08 02:03:53 +0000
commitbf85c62a8df4e9c198ff670414338946d88ed0de (patch)
tree8118db7ed2768ad49de8288af259790b90dd8ff5 /flashrom.c
parenta715893e02195b0f96f15147fbcd612a29e05f44 (diff)
downloadflashrom-bf85c62a8df4e9c198ff670414338946d88ed0de.tar.gz
flashrom-bf85c62a8df4e9c198ff670414338946d88ed0de.tar.bz2
flashrom-bf85c62a8df4e9c198ff670414338946d88ed0de.zip
flashrom.c: Retype appropriate variables with bool
Use the bool type instead of an integer for appropriate variables, since this represents their purpose much better. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: I6629f391284c8f1266e4ba66c9976f3df43955d4 Reviewed-on: https://review.coreboot.org/c/flashrom/+/66883 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'flashrom.c')
-rw-r--r--flashrom.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/flashrom.c b/flashrom.c
index 0e2fa42e..a1e4d230 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -19,6 +19,7 @@
* GNU General Public License for more details.
*/
+#include <stdbool.h>
#include <stdio.h>
#include <sys/types.h>
#include <string.h>
@@ -61,7 +62,7 @@ static struct shutdown_func_data {
/* Initialize to 0 to make sure nobody registers a shutdown function before
* programmer init.
*/
-static int may_register_shutdown = 0;
+static bool may_register_shutdown = false;
/* Did we change something or was every erase/write skipped (if any)? */
static bool all_skipped = true;
@@ -145,7 +146,7 @@ int programmer_init(const struct programmer_entry *prog, const char *param)
/* Default to top aligned flash at 4 GB. */
flashbase = 0;
/* Registering shutdown functions is now allowed. */
- may_register_shutdown = 1;
+ may_register_shutdown = true;
/* Default to allowing writes. Broken programmers set this to 0. */
programmer_may_write = 1;
@@ -181,7 +182,7 @@ int programmer_shutdown(void)
int ret = 0;
/* Registering shutdown functions is no longer allowed. */
- may_register_shutdown = 0;
+ may_register_shutdown = false;
while (shutdown_fn_count > 0) {
int i = --shutdown_fn_count;
ret |= shutdown_fn[i].func(shutdown_fn[i].data);
@@ -517,7 +518,7 @@ static unsigned int get_next_write(const uint8_t *have, const uint8_t *want, uns
unsigned int *first_start,
enum write_granularity gran)
{
- int need_write = 0;
+ bool need_write = false;
unsigned int rel_start = 0, first_len = 0;
unsigned int i, limit, stride;
@@ -562,7 +563,7 @@ static unsigned int get_next_write(const uint8_t *have, const uint8_t *want, uns
if (memcmp(have + i * stride, want + i * stride, limit)) {
if (!need_write) {
/* First location where have and want differ. */
- need_write = 1;
+ need_write = true;
rel_start = i * stride;
}
} else {