mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/7] ARM: socfgpa: Remove redundant assignment
@ 2014-02-16  4:40 Alexander Shiyan
  2014-02-16  4:40 ` [PATCH 2/7] boot command: " Alexander Shiyan
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Alexander Shiyan @ 2014-02-16  4:40 UTC (permalink / raw)
  To: barebox

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/arm/mach-socfpga/include/mach/sequencer.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-socfpga/include/mach/sequencer.c b/arch/arm/mach-socfpga/include/mach/sequencer.c
index fa955ce..6e69d1b 100644
--- a/arch/arm/mach-socfpga/include/mach/sequencer.c
+++ b/arch/arm/mach-socfpga/include/mach/sequencer.c
@@ -3151,7 +3151,6 @@ static uint32_t rw_mgr_mem_calibrate_wlevel (uint32_t g, uint32_t test_bgn)
 		tmp_delay += IO_DELAY_PER_DCHAIN_TAP;
 	}
 	dtaps_per_ptap--;
-	tmp_delay = 0;
 #endif
 
 	/* starting phases */
-- 
1.8.3.2


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

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

* [PATCH 2/7] boot command: Remove redundant assignment
  2014-02-16  4:40 [PATCH 1/7] ARM: socfgpa: Remove redundant assignment Alexander Shiyan
@ 2014-02-16  4:40 ` Alexander Shiyan
  2014-02-16  4:40 ` [PATCH 3/7] mtd: nand_imx: " Alexander Shiyan
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Alexander Shiyan @ 2014-02-16  4:40 UTC (permalink / raw)
  To: barebox

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 commands/boot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/boot.c b/commands/boot.c
index c4b49a9..ccf5827 100644
--- a/commands/boot.c
+++ b/commands/boot.c
@@ -308,7 +308,7 @@ static int boot(const char *name)
 {
 	struct blspec *blspec;
 	struct blspec_entry *entry;
-	int ret = -ENOENT;
+	int ret;
 
 	blspec = blspec_alloc();
 	ret = bootentry_parse_one(blspec, name);
-- 
1.8.3.2


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

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

* [PATCH 3/7] mtd: nand_imx: Remove redundant assignment
  2014-02-16  4:40 [PATCH 1/7] ARM: socfgpa: Remove redundant assignment Alexander Shiyan
  2014-02-16  4:40 ` [PATCH 2/7] boot command: " Alexander Shiyan
@ 2014-02-16  4:40 ` Alexander Shiyan
  2014-02-16  4:40 ` [PATCH 4/7] spi: altera_spi: " Alexander Shiyan
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Alexander Shiyan @ 2014-02-16  4:40 UTC (permalink / raw)
  To: barebox

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/mtd/nand/nand_imx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/nand_imx.c b/drivers/mtd/nand/nand_imx.c
index 6ca8911..e2aaa15 100644
--- a/drivers/mtd/nand/nand_imx.c
+++ b/drivers/mtd/nand/nand_imx.c
@@ -518,7 +518,7 @@ static int imx_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat,
 	struct nand_chip *nand_chip = mtd->priv;
 	struct imx_nand_host *host = nand_chip->priv;
 	u32 ecc_stat, err;
-	int no_subpages = 1;
+	int no_subpages;
 	int ret = 0;
 	u8 ecc_bit_mask, err_limit;
 
-- 
1.8.3.2


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

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

* [PATCH 4/7] spi: altera_spi: Remove redundant assignment
  2014-02-16  4:40 [PATCH 1/7] ARM: socfgpa: Remove redundant assignment Alexander Shiyan
  2014-02-16  4:40 ` [PATCH 2/7] boot command: " Alexander Shiyan
  2014-02-16  4:40 ` [PATCH 3/7] mtd: nand_imx: " Alexander Shiyan
@ 2014-02-16  4:40 ` Alexander Shiyan
  2014-02-16  4:40 ` [PATCH 5/7] USB gadget: " Alexander Shiyan
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Alexander Shiyan @ 2014-02-16  4:40 UTC (permalink / raw)
  To: barebox

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/spi/altera_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/altera_spi.c b/drivers/spi/altera_spi.c
index 60e124f..8803d9e 100644
--- a/drivers/spi/altera_spi.c
+++ b/drivers/spi/altera_spi.c
@@ -112,7 +112,7 @@ static void altera_spi_cs_inactive(struct spi_device *spi)
 static unsigned altera_spi_do_xfer(struct spi_device *spi, struct spi_transfer *t)
 {
 	struct altera_spi *altera_spi = container_of(spi->master, struct altera_spi, master);
-	int word_len = spi->bits_per_word;
+	int word_len;
 	unsigned retval = 0;
 	u32 txval;
 	u32 rxval;
-- 
1.8.3.2


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

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

* [PATCH 5/7] USB gadget: Remove redundant assignment
  2014-02-16  4:40 [PATCH 1/7] ARM: socfgpa: Remove redundant assignment Alexander Shiyan
                   ` (2 preceding siblings ...)
  2014-02-16  4:40 ` [PATCH 4/7] spi: altera_spi: " Alexander Shiyan
@ 2014-02-16  4:40 ` Alexander Shiyan
  2014-02-16  4:40 ` [PATCH 6/7] lib/math.c: Fix possible crash Alexander Shiyan
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Alexander Shiyan @ 2014-02-16  4:40 UTC (permalink / raw)
  To: barebox

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/usb/gadget/composite.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 9af115e..11b6c18 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -204,7 +204,7 @@ int __init usb_interface_id(struct usb_configuration *config,
 static int config_buf(struct usb_configuration *config,
 		enum usb_device_speed speed, void *buf, u8 type)
 {
-	struct usb_config_descriptor	*c = buf;
+	struct usb_config_descriptor	*c;
 	void				*next = buf + USB_DT_CONFIG_SIZE;
 	int				len = USB_BUFSIZ - USB_DT_CONFIG_SIZE;
 	struct usb_function		*f;
-- 
1.8.3.2


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

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

* [PATCH 6/7] lib/math.c: Fix possible crash
  2014-02-16  4:40 [PATCH 1/7] ARM: socfgpa: Remove redundant assignment Alexander Shiyan
                   ` (3 preceding siblings ...)
  2014-02-16  4:40 ` [PATCH 5/7] USB gadget: " Alexander Shiyan
@ 2014-02-16  4:40 ` Alexander Shiyan
  2014-02-17  7:08   ` Sascha Hauer
  2014-02-16  4:40 ` [PATCH 7/7] scripts/kwboot: Remove redundant assignment Alexander Shiyan
  2014-02-17  7:09 ` [PATCH 1/7] ARM: socfgpa: " Sascha Hauer
  6 siblings, 1 reply; 11+ messages in thread
From: Alexander Shiyan @ 2014-02-16  4:40 UTC (permalink / raw)
  To: barebox

Crash can be caused if xzalloc() for "numstack" fails.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 lib/math.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/lib/math.c b/lib/math.c
index a4731ed..1e3ee85 100644
--- a/lib/math.c
+++ b/lib/math.c
@@ -543,11 +543,11 @@ static arith_t evaluate_string(arith_state_t *math_state, const char *expr)
 	/* Stack of operator tokens */
 	operator *const stack = xzalloc(expr_len * sizeof(stack[0]));
 	operator *stackptr = stack;
-	arith_t result;
+	arith_t result = -1;
 
 	if (numstack == NULL || stack == NULL) {
 		errmsg = "out of memory";
-		goto err_with_custom_msg;
+		goto ret;
 	}
 
 	/* Start with a left paren */
@@ -565,7 +565,7 @@ static arith_t evaluate_string(arith_state_t *math_state, const char *expr)
 		if (arithval == '\0') {
 			if (expr == start_expr) {
 				/* Null expression */
-				numstack->val = 0;
+				result = numstack->val;
 				goto ret;
 			}
 
@@ -596,6 +596,7 @@ static arith_t evaluate_string(arith_state_t *math_state, const char *expr)
 				free(numstack->var);
 				numstack->var = NULL;
 			}
+			result = numstack->val;
 			goto ret;
 		}
 
@@ -733,7 +734,7 @@ static arith_t evaluate_string(arith_state_t *math_state, const char *expr)
 				}
 				errmsg = arith_apply(math_state, prev_op, numstack, &numstackptr);
 				if (errmsg)
-					goto err_with_custom_msg;
+					goto ret;
 			}
 			if (op == TOK_RPAREN)
 				goto err;
@@ -746,10 +747,7 @@ next: ;
 
 err:
 	errmsg = "arithmetic syntax error";
-err_with_custom_msg:
-	result = -1;
 ret:
-	result = numstack->val;
 	free(stack);
 	free(numstack);
 	math_state->errmsg = errmsg;
-- 
1.8.3.2


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

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

* [PATCH 7/7] scripts/kwboot: Remove redundant assignment
  2014-02-16  4:40 [PATCH 1/7] ARM: socfgpa: Remove redundant assignment Alexander Shiyan
                   ` (4 preceding siblings ...)
  2014-02-16  4:40 ` [PATCH 6/7] lib/math.c: Fix possible crash Alexander Shiyan
@ 2014-02-16  4:40 ` Alexander Shiyan
  2014-02-17  7:09 ` [PATCH 1/7] ARM: socfgpa: " Sascha Hauer
  6 siblings, 0 replies; 11+ messages in thread
From: Alexander Shiyan @ 2014-02-16  4:40 UTC (permalink / raw)
  To: barebox

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 scripts/kwboot.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/scripts/kwboot.c b/scripts/kwboot.c
index 81da3e8..e068660 100644
--- a/scripts/kwboot.c
+++ b/scripts/kwboot.c
@@ -552,7 +552,6 @@ kwboot_mmap_image(const char *path, size_t *size, int prot)
 	void *img;
 
 	rc = -1;
-	fd = -1;
 	img = NULL;
 
 	fd = open(path, O_RDONLY);
-- 
1.8.3.2


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

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

* Re: [PATCH 6/7] lib/math.c: Fix possible crash
  2014-02-16  4:40 ` [PATCH 6/7] lib/math.c: Fix possible crash Alexander Shiyan
@ 2014-02-17  7:08   ` Sascha Hauer
  2014-02-17  7:23     ` Alexander Aring
  0 siblings, 1 reply; 11+ messages in thread
From: Sascha Hauer @ 2014-02-17  7:08 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

On Sun, Feb 16, 2014 at 08:40:49AM +0400, Alexander Shiyan wrote:
> Crash can be caused if xzalloc() for "numstack" fails.

xzalloc doesn't fail.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

* Re: [PATCH 1/7] ARM: socfgpa: Remove redundant assignment
  2014-02-16  4:40 [PATCH 1/7] ARM: socfgpa: Remove redundant assignment Alexander Shiyan
                   ` (5 preceding siblings ...)
  2014-02-16  4:40 ` [PATCH 7/7] scripts/kwboot: Remove redundant assignment Alexander Shiyan
@ 2014-02-17  7:09 ` Sascha Hauer
  2014-03-08  6:41   ` Alexander Shiyan
  6 siblings, 1 reply; 11+ messages in thread
From: Sascha Hauer @ 2014-02-17  7:09 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

On Sun, Feb 16, 2014 at 08:40:44AM +0400, Alexander Shiyan wrote:
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>

Applied all except 6/7 which probably needs some adjustments.

Sascha

> ---
>  arch/arm/mach-socfpga/include/mach/sequencer.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/arch/arm/mach-socfpga/include/mach/sequencer.c b/arch/arm/mach-socfpga/include/mach/sequencer.c
> index fa955ce..6e69d1b 100644
> --- a/arch/arm/mach-socfpga/include/mach/sequencer.c
> +++ b/arch/arm/mach-socfpga/include/mach/sequencer.c
> @@ -3151,7 +3151,6 @@ static uint32_t rw_mgr_mem_calibrate_wlevel (uint32_t g, uint32_t test_bgn)
>  		tmp_delay += IO_DELAY_PER_DCHAIN_TAP;
>  	}
>  	dtaps_per_ptap--;
> -	tmp_delay = 0;
>  #endif
>  
>  	/* starting phases */
> -- 
> 1.8.3.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

* Re: [PATCH 6/7] lib/math.c: Fix possible crash
  2014-02-17  7:08   ` Sascha Hauer
@ 2014-02-17  7:23     ` Alexander Aring
  0 siblings, 0 replies; 11+ messages in thread
From: Alexander Aring @ 2014-02-17  7:23 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On Mon, Feb 17, 2014 at 08:08:09AM +0100, Sascha Hauer wrote:
> On Sun, Feb 16, 2014 at 08:40:49AM +0400, Alexander Shiyan wrote:
> > Crash can be caused if xzalloc() for "numstack" fails.
> 
> xzalloc doesn't fail.
> 
Some little offtopic to this issue:

I am falling sometimes in the same trap and then it reminds me "xzalloc
will occur a panic when internal malloc fails". In the world of barebox
we need to think a little bit different than in the world of linux. But
this is actually a behaviour what we don't want, we want to think in
linux way, when you programming barebox.

On the other hand, bootloader is a bootloader and need little code and
this reduce a many error branches of barebox so "xzalloc" is just a
great idea.

I want to mention that, Alexander is not alone. :-)

...maybe some codestyle checkers will detected this as a missing error
handling.

- Alex

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

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

* Re: [PATCH 1/7] ARM: socfgpa: Remove redundant assignment
  2014-02-17  7:09 ` [PATCH 1/7] ARM: socfgpa: " Sascha Hauer
@ 2014-03-08  6:41   ` Alexander Shiyan
  0 siblings, 0 replies; 11+ messages in thread
From: Alexander Shiyan @ 2014-03-08  6:41 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On Mon, 17 Feb 2014 08:09:09 +0100
Sascha Hauer <s.hauer@pengutronix.de> wrote:

> On Sun, Feb 16, 2014 at 08:40:44AM +0400, Alexander Shiyan wrote:
> > Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> 
> Applied all except 6/7 which probably needs some adjustments.

It seems that the patches are lost.
I do not see them in the master branch.

-- 
Alexander Shiyan <shc_work@mail.ru>

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

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

end of thread, other threads:[~2014-03-08  6:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-16  4:40 [PATCH 1/7] ARM: socfgpa: Remove redundant assignment Alexander Shiyan
2014-02-16  4:40 ` [PATCH 2/7] boot command: " Alexander Shiyan
2014-02-16  4:40 ` [PATCH 3/7] mtd: nand_imx: " Alexander Shiyan
2014-02-16  4:40 ` [PATCH 4/7] spi: altera_spi: " Alexander Shiyan
2014-02-16  4:40 ` [PATCH 5/7] USB gadget: " Alexander Shiyan
2014-02-16  4:40 ` [PATCH 6/7] lib/math.c: Fix possible crash Alexander Shiyan
2014-02-17  7:08   ` Sascha Hauer
2014-02-17  7:23     ` Alexander Aring
2014-02-16  4:40 ` [PATCH 7/7] scripts/kwboot: Remove redundant assignment Alexander Shiyan
2014-02-17  7:09 ` [PATCH 1/7] ARM: socfgpa: " Sascha Hauer
2014-03-08  6:41   ` Alexander Shiyan

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