summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrzysztof Halasa <khc@pm.waw.pl>2010-12-21 00:02:02 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2010-12-21 09:02:40 +0100
commitd66ae58cd87c78b76652ecf750371b1e005d44de (patch)
tree90e82954c07e8e412f7c72d402c64b5de2f182f4
parentb754bc4cf0f2687411e9dde3a2115a9c5b8da79a (diff)
downloadbarebox-d66ae58cd87c78b76652ecf750371b1e005d44de.tar.gz
barebox-d66ae58cd87c78b76652ecf750371b1e005d44de.tar.xz
Cosmetic fixes, including format attributes for printf() and friends.
Signed-off-by: Krzysztof HaƂasa <khc@pm.waw.pl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--commands/crc.c2
-rw-r--r--commands/flash.c4
-rw-r--r--commands/go.c2
-rw-r--r--commands/loadb.c1
-rw-r--r--commands/ls.c4
-rw-r--r--commands/menu.c2
-rw-r--r--drivers/net/netx_eth.c1
-rw-r--r--drivers/nor/cfi_flash.c8
-rw-r--r--include/stdio.h18
-rw-r--r--net/tftp.c2
10 files changed, 22 insertions, 22 deletions
diff --git a/commands/crc.c b/commands/crc.c
index 0873a1c07e..993074c746 100644
--- a/commands/crc.c
+++ b/commands/crc.c
@@ -134,7 +134,7 @@ static int do_crc(struct command *cmdtp, int argc, char *argv[])
#endif
if (verify && crc != vcrc) {
- printf(" != 0x%08x ** ERROR **", vcrc);
+ printf(" != 0x%08lx ** ERROR **", vcrc);
err = 1;
}
diff --git a/commands/flash.c b/commands/flash.c
index 9a0eb50371..a3f3508f2f 100644
--- a/commands/flash.c
+++ b/commands/flash.c
@@ -63,7 +63,7 @@ static int do_flerase(struct command *cmdtp, int argc, char *argv[])
fd = open(filename, O_WRONLY);
if (fd < 0) {
- printf("open %s:", filename, errno_str());
+ printf("open %s: %s", filename, errno_str());
return 1;
}
@@ -139,7 +139,7 @@ static int do_protect(struct command *cmdtp, int argc, char *argv[])
fd = open(filename, O_WRONLY);
if (fd < 0) {
- printf("open %s:", filename, errno_str());
+ printf("open %s: %s", filename, errno_str());
return 1;
}
diff --git a/commands/go.c b/commands/go.c
index 02629402ad..6082fe54e3 100644
--- a/commands/go.c
+++ b/commands/go.c
@@ -55,7 +55,7 @@ static int do_go(struct command *cmdtp, int argc, char *argv[])
} else
addr = (void *)simple_strtoul(argv[1], NULL, 16);
- printf("## Starting application at 0x%08lX ...\n", addr);
+ printf("## Starting application at 0x%p ...\n", addr);
console_flush();
diff --git a/commands/loadb.c b/commands/loadb.c
index dc0e517b57..439a83a45c 100644
--- a/commands/loadb.c
+++ b/commands/loadb.c
@@ -625,7 +625,6 @@ static ulong load_serial_ymodem(void)
int res, wr;
connection_info_t info;
char ymodemBuf[1024];
- ulong store_addr = ~0;
ulong addr = 0;
size = 0;
diff --git a/commands/ls.c b/commands/ls.c
index 4f9c408b1d..278a8bcad2 100644
--- a/commands/ls.c
+++ b/commands/ls.c
@@ -32,10 +32,10 @@
static void ls_one(const char *path, struct stat *s)
{
char modestr[11];
- unsigned long namelen = strlen(path);
+ unsigned int namelen = strlen(path);
mkmodestr(s->st_mode, modestr);
- printf("%s %10u %*.*s\n", modestr, s->st_size, namelen, namelen, path);
+ printf("%s %10lu %*.*s\n", modestr, s->st_size, namelen, namelen, path);
}
int ls(const char *path, ulong flags)
diff --git a/commands/menu.c b/commands/menu.c
index b9d66996a4..c3e090170a 100644
--- a/commands/menu.c
+++ b/commands/menu.c
@@ -119,7 +119,7 @@ static int do_menu_entry_remove(struct cmd_menu *cm)
me = menu_entry_get_by_num(m, cm->num);
if (!me) {
- eprintf("Entry '%s' not found\n", cm->num);
+ eprintf("Entry '%i' not found\n", cm->num);
return -EINVAL;
}
diff --git a/drivers/net/netx_eth.c b/drivers/net/netx_eth.c
index 7d55a61384..fd40f6271a 100644
--- a/drivers/net/netx_eth.c
+++ b/drivers/net/netx_eth.c
@@ -7,7 +7,6 @@
#include <mach/netx-eth.h>
#include <mach/netx-regs.h>
#include <xfuncs.h>
-#include <miidev.h>
#include <init.h>
#include <driver.h>
diff --git a/drivers/nor/cfi_flash.c b/drivers/nor/cfi_flash.c
index 88ca7e6af2..1bd1377722 100644
--- a/drivers/nor/cfi_flash.c
+++ b/drivers/nor/cfi_flash.c
@@ -485,7 +485,7 @@ static int __cfi_erase(struct cdev *cdev, size_t count, unsigned long offset,
unsigned long start, end;
int i, ret = 0;
- debug("%s: erase 0x%08x (size %d)\n", __func__, offset, count);
+ debug("%s: erase 0x%08lx (size %d)\n", __func__, offset, count);
start = find_sector(finfo, cdev->dev->map_base + offset);
end = find_sector(finfo, cdev->dev->map_base + offset + count - 1);
@@ -656,8 +656,8 @@ static int cfi_protect(struct cdev *cdev, size_t count, unsigned long offset, in
int i, ret = 0;
const char *action = (prot? "protect" : "unprotect");
- printf("%s: %s 0x%08x (size %d)\n", __FUNCTION__,
- action, cdev->dev->map_base + offset, count);
+ printf("%s: %s 0x%08lx (size %d)\n", __FUNCTION__,
+ action, cdev->dev->map_base + offset, count);
start = find_sector(finfo, cdev->dev->map_base + offset);
end = find_sector(finfo, cdev->dev->map_base + offset + count - 1);
@@ -1012,7 +1012,7 @@ static int cfi_probe (struct device_d *dev)
info->base = (void __iomem *)dev->map_base;
if (dev->size == 0) {
- printf("cfi_probe: size : 0x%08x\n", info->size);
+ printf("cfi_probe: size : 0x%08lx\n", info->size);
dev->size = info->size;
}
diff --git a/include/stdio.h b/include/stdio.h
index 8bc45fa60e..c824764689 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -9,7 +9,7 @@
*/
/* serial stuff */
-void serial_printf (const char *fmt, ...);
+void serial_printf(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
/* stdin */
int tstc(void);
@@ -20,20 +20,22 @@ int getc(void);
void console_puts(unsigned int ch, const char *s);
void console_flush(void);
-static inline void puts(const char *s) {
+static inline void puts(const char *s)
+{
console_puts(CONSOLE_STDOUT, s);
}
-static inline void putchar(char c) {
+static inline void putchar(char c)
+{
console_putc(CONSOLE_STDOUT, c);
}
-int printf(const char *fmt, ...);
+int printf(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
int vprintf(const char *fmt, va_list args);
-int sprintf(char * buf, const char *fmt, ...);
-int snprintf(char *buf, size_t size, const char *fmt, ...);
+int sprintf(char *buf, const char *fmt, ...) __attribute__ ((format(printf, 2, 3)));
+int snprintf(char *buf, size_t size, const char *fmt, ...) __attribute__ ((format(printf, 3, 4)));
int vsprintf(char *buf, const char *fmt, va_list args);
-char *asprintf(const char *fmt, ...);
+char *asprintf(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
char *vasprintf(const char *fmt, va_list ap);
int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
@@ -52,7 +54,7 @@ int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
#define stderr 2
#define MAX_FILES 128
-void fprintf(int file, const char *fmt, ...);
+void fprintf(int file, const char *fmt, ...) __attribute__ ((format(printf, 2, 3)));
int fputs(int file, const char *s);
int fputc(int file, const char c);
int ftstc(int file);
diff --git a/net/tftp.c b/net/tftp.c
index 6be8b8f623..0f38b6b9b0 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -218,7 +218,7 @@ static void tftp_handler(char *packet, unsigned len)
tftp_last_block = 0;
if (tftp_block != 1) { /* Assertion */
- printf("error: First block is not block 1 (%ld)\n",
+ printf("error: First block is not block 1 (%d)\n",
tftp_block);
tftp_err = -EINVAL;
tftp_state = STATE_DONE;