[coreboot-gerrit] Patch set updated for coreboot: src/lib: Clean up general issues found by checkpatch.pl

Lee Leahy (leroy.p.leahy@intel.com) gerrit at coreboot.org
Tue Mar 14 21:08:08 CET 2017


Lee Leahy (leroy.p.leahy at intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18763

-gerrit

commit fb305529a505051490f7c862e4914131540404e8
Author: Lee Leahy <leroy.p.leahy at intel.com>
Date:   Fri Mar 10 17:56:44 2017 -0800

    src/lib: Clean up general issues found by checkpatch.pl
    
    Fix the following errors and warnings detected by checkpatch.pl:
    
    ERROR: Bad function definition - void init_timer() should probably be void init_timer(void)
    ERROR: Prefixing 0x with decimal output is defective
    WARNING: Comparisons should place the constant on the right side of the test
    WARNING: char * array declaration might be better as static const
    
    TEST=Build and run on Galileo Gen2
    
    Change-Id: I9f618eea95e1f92fa34f4f89da27c0b16ae7f4ee
    Signed-off-by: Lee Leahy <Leroy.P.Leahy at intel.com>
---
 src/lib/edid.c       | 2 +-
 src/lib/gcov-glue.c  | 2 +-
 src/lib/reg_script.c | 4 ++--
 src/lib/timer.c      | 2 +-
 src/lib/tlcl.c       | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/lib/edid.c b/src/lib/edid.c
index 95ff92f..58dd813 100644
--- a/src/lib/edid.c
+++ b/src/lib/edid.c
@@ -117,7 +117,7 @@ static int
 detailed_cvt_descriptor(unsigned char *x, int first)
 {
 	const unsigned char empty[3] = { 0, 0, 0 };
-	const char *names[] = { "50", "60", "75", "85" };
+	static const char *names[] = { "50", "60", "75", "85" };
 	int width = 0, height = 0;
 	int valid = 1;
 	int fifty = 0, sixty = 0, seventyfive = 0, eightyfive = 0, reduced = 0;
diff --git a/src/lib/gcov-glue.c b/src/lib/gcov-glue.c
index 4e46367..a002ea7 100644
--- a/src/lib/gcov-glue.c
+++ b/src/lib/gcov-glue.c
@@ -114,7 +114,7 @@ static size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
 static size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
 {
 #if CONFIG_DEBUG_COVERAGE
-	printk(BIOS_DEBUG, "fwrite: %zd * 0x%zd bytes to file %s\n",
+	printk(BIOS_DEBUG, "fwrite: %zd * %zd bytes to file %s\n",
 		nmemb, size, stream->filename);
 #endif
 	// TODO check if file is last opened file and fail otherwise.
diff --git a/src/lib/reg_script.c b/src/lib/reg_script.c
index e3b453d..8d813b6 100644
--- a/src/lib/reg_script.c
+++ b/src/lib/reg_script.c
@@ -476,7 +476,7 @@ static uint64_t reg_script_read(struct reg_script_context *ctx)
 
 			/* Read from the platform specific bus */
 			bus = find_bus(step);
-			if (NULL != bus) {
+			if (bus != NULL) {
 				value = bus->reg_script_read(ctx);
 				break;
 			}
@@ -530,7 +530,7 @@ static void reg_script_write(struct reg_script_context *ctx)
 
 			/* Write to the platform specific bus */
 			bus = find_bus(step);
-			if (NULL != bus) {
+			if (bus != NULL) {
 				bus->reg_script_write(ctx);
 				break;
 			}
diff --git a/src/lib/timer.c b/src/lib/timer.c
index 0796d99..58d32ee 100644
--- a/src/lib/timer.c
+++ b/src/lib/timer.c
@@ -18,7 +18,7 @@
 #include <delay.h>
 #include <thread.h>
 
-__attribute__((weak)) void init_timer() { /* do nothing */ }
+__attribute__((weak)) void init_timer(void) { /* do nothing */ }
 
 void udelay(unsigned int usec)
 {
diff --git a/src/lib/tlcl.c b/src/lib/tlcl.c
index 34da816..49854cb 100644
--- a/src/lib/tlcl.c
+++ b/src/lib/tlcl.c
@@ -86,7 +86,7 @@ static uint32_t tlcl_send_receive_no_retry(const uint8_t *request,
 
 	result = tpm_send_receive(request, tpm_command_size(request),
 					response, &response_length);
-	if (0 != result) {
+	if (result != 0) {
 		/* Communication with TPM failed, so response is garbage */
 		VBDEBUG("TPM: command 0x%x send/receive failed: 0x%x\n",
 			tpm_command_code(request), result);



More information about the coreboot-gerrit mailing list