mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 01/10] ARM: socfpga: fix compiler warning
@ 2016-11-23  9:39 Sascha Hauer
  2016-11-23  9:39 ` [PATCH 02/10] nios2: Fix out of tree build Sascha Hauer
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Sascha Hauer @ 2016-11-23  9:39 UTC (permalink / raw)
  To: Barebox List

Fixes:
arm/mach-socfpga/xload.c:31:52: warning: initialization from incompatible pointer type

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-socfpga/xload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-socfpga/xload.c b/arch/arm/mach-socfpga/xload.c
index 9936269..0e584c3 100644
--- a/arch/arm/mach-socfpga/xload.c
+++ b/arch/arm/mach-socfpga/xload.c
@@ -28,7 +28,7 @@ static struct socfpga_barebox_part default_parts[] = {
 	},
 	{ /* sentinel */ }
 };
-const struct socfpga_barebox_part *barebox_parts = &default_parts;
+const struct socfpga_barebox_part *barebox_parts = default_parts;
 
 enum socfpga_clks {
 	timer, mmc, qspi_clk, uart, clk_max
-- 
2.10.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 02/10] nios2: Fix out of tree build
  2016-11-23  9:39 [PATCH 01/10] ARM: socfpga: fix compiler warning Sascha Hauer
@ 2016-11-23  9:39 ` Sascha Hauer
  2016-11-23  9:39 ` [PATCH 03/10] nios2: Fix compiler warning Sascha Hauer
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2016-11-23  9:39 UTC (permalink / raw)
  To: Barebox List

nios2 links the board specific nios_sopc.h to include/. The relative
pathes used do not work with an out of tree build. Use absolute pathes
instead.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/nios2/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/nios2/Makefile b/arch/nios2/Makefile
index 681944f..3e97155 100644
--- a/arch/nios2/Makefile
+++ b/arch/nios2/Makefile
@@ -7,7 +7,7 @@ KALLSYMS += --symbol-prefix=_
 archprepare: maketools
 
 	@$(kecho) "  SYMLINK include/nios_sopc.h -> arch/nios2/boards/$(board-y)/nios_sopc.h"
-	@ln -fsn ../arch/nios2/boards/$(board-y)/nios_sopc.h include/nios_sopc.h
+	@ln -fsn $(src)/arch/nios2/boards/$(board-y)/nios_sopc.h $(obj)/include/nios_sopc.h
 
 PHONY += maketools
 
-- 
2.10.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 03/10] nios2: Fix compiler warning
  2016-11-23  9:39 [PATCH 01/10] ARM: socfpga: fix compiler warning Sascha Hauer
  2016-11-23  9:39 ` [PATCH 02/10] nios2: Fix out of tree build Sascha Hauer
@ 2016-11-23  9:39 ` Sascha Hauer
  2016-11-23  9:39 ` [PATCH 04/10] globalvar: " Sascha Hauer
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2016-11-23  9:39 UTC (permalink / raw)
  To: Barebox List

An initcall function needs to return a value, so return one.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/nios2/cpu/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/nios2/cpu/cpu.c b/arch/nios2/cpu/cpu.c
index b2164af..77fde6b 100644
--- a/arch/nios2/cpu/cpu.c
+++ b/arch/nios2/cpu/cpu.c
@@ -33,7 +33,7 @@ static void __noreturn nios2_restart_soc(struct restart_handler *rst)
 
 static int restart_register_feature(void)
 {
-	restart_handler_register_fn(nios2_restart_soc);
+	return restart_handler_register_fn(nios2_restart_soc);
 }
 coredevice_initcall(restart_register_feature);
 
-- 
2.10.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 04/10] globalvar: Fix compiler warning
  2016-11-23  9:39 [PATCH 01/10] ARM: socfpga: fix compiler warning Sascha Hauer
  2016-11-23  9:39 ` [PATCH 02/10] nios2: Fix out of tree build Sascha Hauer
  2016-11-23  9:39 ` [PATCH 03/10] nios2: Fix compiler warning Sascha Hauer
@ 2016-11-23  9:39 ` Sascha Hauer
  2016-11-23  9:39 ` [PATCH 05/10] mtd: peb: fix usage of uninitialized variable Sascha Hauer
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2016-11-23  9:39 UTC (permalink / raw)
  To: Barebox List

Fixes:
common/globalvar.c:393:7: warning: 'pname' may be used uninitialized in this function [-Wmaybe-uninitialized]

This is a false positive, pname cannot be uninitialized. Silence this
warning.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/globalvar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/globalvar.c b/common/globalvar.c
index 85d0795..52808f8 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -382,7 +382,7 @@ void globalvar_set_match(const char *match, const char *val)
 static int globalvar_simple_set(struct device_d *dev, struct param_d *p, const char *val)
 {
 	struct device_d *rdev;
-	const char *pname;
+	const char *pname = NULL;
 	int ret;
 
 	ret = nvvar_device_dispatch(p->name, &rdev, &pname);
-- 
2.10.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 05/10] mtd: peb: fix usage of uninitialized variable
  2016-11-23  9:39 [PATCH 01/10] ARM: socfpga: fix compiler warning Sascha Hauer
                   ` (2 preceding siblings ...)
  2016-11-23  9:39 ` [PATCH 04/10] globalvar: " Sascha Hauer
@ 2016-11-23  9:39 ` Sascha Hauer
  2016-11-23  9:39 ` [PATCH 06/10] mtd: peb: Fix format specifier Sascha Hauer
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2016-11-23  9:39 UTC (permalink / raw)
  To: Barebox List

'read' is used in an error message but never assigned a value to. Remove
the variable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mtd/peb.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/peb.c b/drivers/mtd/peb.c
index 639dc0e..73f90bb 100644
--- a/drivers/mtd/peb.c
+++ b/drivers/mtd/peb.c
@@ -252,7 +252,6 @@ retry:
 int mtd_peb_check_all_ff(struct mtd_info *mtd, int pnum, int offset, int len,
 			 int warn)
 {
-	size_t read;
 	int err;
 	void *buf;
 
@@ -263,8 +262,8 @@ int mtd_peb_check_all_ff(struct mtd_info *mtd, int pnum, int offset, int len,
 	err = mtd_peb_read(mtd, buf, pnum, offset, len);
 	if (err && !mtd_is_bitflip(err)) {
 		dev_err(&mtd->class_dev,
-			"error %d while reading %d bytes from PEB %d:%d, read %zd bytes\n",
-			err, len, pnum, offset, read);
+			"error %d while reading %d bytes from PEB %d:%d\n",
+			err, len, pnum, offset);
 		goto out;
 	}
 
-- 
2.10.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 06/10] mtd: peb: Fix format specifier
  2016-11-23  9:39 [PATCH 01/10] ARM: socfpga: fix compiler warning Sascha Hauer
                   ` (3 preceding siblings ...)
  2016-11-23  9:39 ` [PATCH 05/10] mtd: peb: fix usage of uninitialized variable Sascha Hauer
@ 2016-11-23  9:39 ` Sascha Hauer
  2016-11-23  9:39 ` [PATCH 07/10] ARM: socfpga: fix compiler warning Sascha Hauer
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2016-11-23  9:39 UTC (permalink / raw)
  To: Barebox List

The correct format specifier for size_t is %zu. Use it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mtd/peb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/peb.c b/drivers/mtd/peb.c
index 73f90bb..66227d4 100644
--- a/drivers/mtd/peb.c
+++ b/drivers/mtd/peb.c
@@ -397,7 +397,7 @@ int mtd_peb_write(struct mtd_info *mtd, const void *buf, int pnum, int offset,
 	addr = (loff_t)pnum * mtd->erasesize + offset;
 	err = mtd_write(mtd, addr, len, &written, buf);
 	if (err) {
-		dev_err(&mtd->class_dev, "error %d while writing %d bytes to PEB %d:%d, written %zd bytes\n",
+		dev_err(&mtd->class_dev, "error %d while writing %d bytes to PEB %d:%d, written %zu bytes\n",
 			err, len, pnum, offset, written);
 	} else {
 		if (written != len)
-- 
2.10.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 07/10] ARM: socfpga: fix compiler warning
  2016-11-23  9:39 [PATCH 01/10] ARM: socfpga: fix compiler warning Sascha Hauer
                   ` (4 preceding siblings ...)
  2016-11-23  9:39 ` [PATCH 06/10] mtd: peb: Fix format specifier Sascha Hauer
@ 2016-11-23  9:39 ` Sascha Hauer
  2016-11-23  9:39 ` [PATCH 08/10] of: Use %pa to print resource_size_t type Sascha Hauer
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2016-11-23  9:39 UTC (permalink / raw)
  To: Barebox List

Fixes:
arch/arm/mach-socfpga/xload.c:121:13: warning: assignment discards 'const' qualifier from pointer target type

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-socfpga/xload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-socfpga/xload.c b/arch/arm/mach-socfpga/xload.c
index 0e584c3..d24944b 100644
--- a/arch/arm/mach-socfpga/xload.c
+++ b/arch/arm/mach-socfpga/xload.c
@@ -111,7 +111,7 @@ static void socfpga_timer_init(void)
 static __noreturn int socfpga_xload(void)
 {
 	enum bootsource bootsource = bootsource_get();
-	struct socfpga_barebox_part *part;
+	const struct socfpga_barebox_part *part;
 	void *buf = NULL;
 
 	switch (bootsource) {
-- 
2.10.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 08/10] of: Use %pa to print resource_size_t type
  2016-11-23  9:39 [PATCH 01/10] ARM: socfpga: fix compiler warning Sascha Hauer
                   ` (5 preceding siblings ...)
  2016-11-23  9:39 ` [PATCH 07/10] ARM: socfpga: fix compiler warning Sascha Hauer
@ 2016-11-23  9:39 ` Sascha Hauer
  2016-11-23  9:39 ` [PATCH 09/10] menu: sanitize menu_add_title Sascha Hauer
  2016-11-23  9:39 ` [PATCH 10/10] arm: at91 bootstrap: Fix menu title Sascha Hauer
  8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2016-11-23  9:39 UTC (permalink / raw)
  To: Barebox List

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/of/platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 3f848a4..c9157cd 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -271,7 +271,7 @@ static struct device_d *of_amba_device_create(struct device_node *np)
 	/* Allow the HW Peripheral ID to be overridden */
 	of_property_read_u32(np, "arm,primecell-periphid", &dev->periphid);
 
-	debug("register device 0x%08x\n", dev->dev.resource[0].start);
+	debug("register device %pa\n", &dev->dev.resource[0].start);
 
 	ret = amba_device_add(dev);
 	if (ret)
-- 
2.10.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 09/10] menu: sanitize menu_add_title
  2016-11-23  9:39 [PATCH 01/10] ARM: socfpga: fix compiler warning Sascha Hauer
                   ` (6 preceding siblings ...)
  2016-11-23  9:39 ` [PATCH 08/10] of: Use %pa to print resource_size_t type Sascha Hauer
@ 2016-11-23  9:39 ` Sascha Hauer
  2016-11-23  9:39 ` [PATCH 10/10] arm: at91 bootstrap: Fix menu title Sascha Hauer
  8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2016-11-23  9:39 UTC (permalink / raw)
  To: Barebox List

passing a string to menu_add_title() which then gets free by this
function is just plain ugly. Pass it a const char * which gets
duplicated in menu_add_title() when necessary.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/menu.c |  2 +-
 common/boot.c   |  2 +-
 common/menu.c   | 12 +++++-------
 include/menu.h  |  2 +-
 4 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/commands/menu.c b/commands/menu.c
index 72db26e..ddc9c3a 100644
--- a/commands/menu.c
+++ b/commands/menu.c
@@ -147,7 +147,7 @@ static int do_menu_add(struct cmd_menu *cm)
 	if (!m->name)
 		goto free;
 
-	menu_add_title(m, strdup(cm->description));
+	menu_add_title(m, cm->description);
 
 	ret = menu_add(m);
 
diff --git a/common/boot.c b/common/boot.c
index 123b874..4306319 100644
--- a/common/boot.c
+++ b/common/boot.c
@@ -44,7 +44,7 @@ struct bootentries *bootentries_alloc(void)
 
 	if (IS_ENABLED(CONFIG_MENU)) {
 		bootentries->menu = menu_alloc();
-		menu_add_title(bootentries->menu, basprintf("boot"));
+		menu_add_title(bootentries->menu, "boot");
 	}
 
 	return bootentries;
diff --git a/common/menu.c b/common/menu.c
index 64df458..e757216 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -526,18 +526,17 @@ EXPORT_SYMBOL(menu_add_command_entry);
  * @display: NULL or pointer to the string which will be freed in this function.
  *	If NULL or zero length string is provided, default title will be added.
  */
-void menu_add_title(struct menu *m, char *display)
+void menu_add_title(struct menu *m, const char *display)
 {
 	char *tmp, *src, *dst;
 	int lines = 1;
 	int i;
 
-	if (!display || !strlen(display)) {
-		free(display);
-		display = xasprintf("Menu : %s", m->name ? m->name : "");
-	}
+	if (!display || !strlen(display))
+		src = dst = tmp = xasprintf("Menu : %s", m->name ? m->name : "");
+	else
+		src = dst = tmp = xstrdup(display);
 
-	src = dst = tmp = xstrdup(display);
 	/* Count lines and separate single string into multiple strings */
 	while (*src) {
 		if (*src == '\\') {
@@ -575,6 +574,5 @@ void menu_add_title(struct menu *m, char *display)
 	}
 
 	free(tmp);
-	free(display);
 }
 EXPORT_SYMBOL(menu_add_title);
diff --git a/include/menu.h b/include/menu.h
index 3e704a8..2fef064 100644
--- a/include/menu.h
+++ b/include/menu.h
@@ -91,7 +91,7 @@ int menu_set_selected_entry(struct menu *m, struct menu_entry* me);
 int menu_set_selected(struct menu *m, int num);
 int menu_set_auto_select(struct menu *m, int delay);
 struct menu* menu_get_menus(void);
-void menu_add_title(struct menu *m, char *display);
+void menu_add_title(struct menu *m, const char *display);
 
 /*
  * menu entry functions
-- 
2.10.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 10/10] arm: at91 bootstrap: Fix menu title
  2016-11-23  9:39 [PATCH 01/10] ARM: socfpga: fix compiler warning Sascha Hauer
                   ` (7 preceding siblings ...)
  2016-11-23  9:39 ` [PATCH 09/10] menu: sanitize menu_add_title Sascha Hauer
@ 2016-11-23  9:39 ` Sascha Hauer
  8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2016-11-23  9:39 UTC (permalink / raw)
  To: Barebox List

It's no longer possible to assign a string to menu->display, instead
menu_add_title() must be called. Fix this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-at91/bootstrap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-at91/bootstrap.c b/arch/arm/mach-at91/bootstrap.c
index 8502bb0..9dd575b 100644
--- a/arch/arm/mach-at91/bootstrap.c
+++ b/arch/arm/mach-at91/bootstrap.c
@@ -155,7 +155,8 @@ void at91_bootstrap_menu(void)
 	struct menu_entry *me;
 
 	m = menu_alloc();
-	m->display = m->name = "boot";
+	m->name = "boot";
+	menu_add_title(m, m->name);
 
 	menu_add(m);
 
-- 
2.10.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-11-23  9:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-23  9:39 [PATCH 01/10] ARM: socfpga: fix compiler warning Sascha Hauer
2016-11-23  9:39 ` [PATCH 02/10] nios2: Fix out of tree build Sascha Hauer
2016-11-23  9:39 ` [PATCH 03/10] nios2: Fix compiler warning Sascha Hauer
2016-11-23  9:39 ` [PATCH 04/10] globalvar: " Sascha Hauer
2016-11-23  9:39 ` [PATCH 05/10] mtd: peb: fix usage of uninitialized variable Sascha Hauer
2016-11-23  9:39 ` [PATCH 06/10] mtd: peb: Fix format specifier Sascha Hauer
2016-11-23  9:39 ` [PATCH 07/10] ARM: socfpga: fix compiler warning Sascha Hauer
2016-11-23  9:39 ` [PATCH 08/10] of: Use %pa to print resource_size_t type Sascha Hauer
2016-11-23  9:39 ` [PATCH 09/10] menu: sanitize menu_add_title Sascha Hauer
2016-11-23  9:39 ` [PATCH 10/10] arm: at91 bootstrap: Fix menu title Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox