mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/4] MIPS: mach-ar231x: Fix uninitialized variable
@ 2014-01-29 18:21 Alexander Shiyan
  2014-01-29 18:21 ` [PATCH 2/4] ppc 8xxx: Fix logic Alexander Shiyan
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Alexander Shiyan @ 2014-01-29 18:21 UTC (permalink / raw)
  To: barebox

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/mips/mach-ar231x/board.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/mach-ar231x/board.c b/arch/mips/mach-ar231x/board.c
index f1b876f..8bd1787 100644
--- a/arch/mips/mach-ar231x/board.c
+++ b/arch/mips/mach-ar231x/board.c
@@ -111,7 +111,7 @@ static u16
 ar231x_cksum16(u8 *data, int size)
 {
 	int i;
-	u16 sum;
+	u16 sum = 0;
 
 	for (i = 0; i < size; i++)
 		sum += data[i];
-- 
1.8.3.2


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

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

* [PATCH 2/4] ppc 8xxx: Fix logic
  2014-01-29 18:21 [PATCH 1/4] MIPS: mach-ar231x: Fix uninitialized variable Alexander Shiyan
@ 2014-01-29 18:21 ` Alexander Shiyan
  2014-01-29 18:21 ` [PATCH 3/4] gadget: at91: Fix uninitialized variable Alexander Shiyan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Alexander Shiyan @ 2014-01-29 18:21 UTC (permalink / raw)
  To: barebox

Expression (pdimm->data_width >= 32) || (pdimm->data_width <= 40)
always evaluates to true, so probably we need to use "&&" here.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/ppc/ddr-8xxx/options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/ppc/ddr-8xxx/options.c b/arch/ppc/ddr-8xxx/options.c
index 22b621f..9ce2bc1 100644
--- a/arch/ppc/ddr-8xxx/options.c
+++ b/arch/ppc/ddr-8xxx/options.c
@@ -48,7 +48,7 @@ uint32_t populate_memctl_options(int all_DIMMs_registered,
 	if (pdimm->n_ranks != 0) {
 		if ((pdimm->data_width >= 64) && (pdimm->data_width <= 72))
 			popts->data_bus_width = 0;
-		else if ((pdimm->data_width >= 32) ||
+		else if ((pdimm->data_width >= 32) &&
 			(pdimm->data_width <= 40))
 			popts->data_bus_width = 1;
 		else
-- 
1.8.3.2


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

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

* [PATCH 3/4] gadget: at91: Fix uninitialized variable
  2014-01-29 18:21 [PATCH 1/4] MIPS: mach-ar231x: Fix uninitialized variable Alexander Shiyan
  2014-01-29 18:21 ` [PATCH 2/4] ppc 8xxx: Fix logic Alexander Shiyan
@ 2014-01-29 18:21 ` Alexander Shiyan
  2014-01-29 18:21 ` [PATCH 4/4] scripts: imx-usb-loader: Fix memory leak Alexander Shiyan
  2014-01-29 20:39 ` [PATCH 1/4] MIPS: mach-ar231x: Fix uninitialized variable Sascha Hauer
  3 siblings, 0 replies; 6+ messages in thread
From: Alexander Shiyan @ 2014-01-29 18:21 UTC (permalink / raw)
  To: barebox

Variable udc is used unitialized for DBG(xxx).

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

diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index acd9e44..6eeef7d 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -1417,7 +1417,7 @@ static struct poller_struct poller = {
 
 static int __init at91udc_probe(struct device_d *dev)
 {
-	struct at91_udc	*udc;
+	struct at91_udc	*udc = &controller;
 	int		retval;
 
 	if (!dev->platform_data) {
@@ -1427,7 +1427,6 @@ static int __init at91udc_probe(struct device_d *dev)
 	}
 
 	/* init software state */
-	udc = &controller;
 	udc->dev = dev;
 	udc->board = *(struct at91_udc_data *) dev->platform_data;
 	udc->enabled = 0;
-- 
1.8.3.2


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

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

* [PATCH 4/4] scripts: imx-usb-loader: Fix memory leak
  2014-01-29 18:21 [PATCH 1/4] MIPS: mach-ar231x: Fix uninitialized variable Alexander Shiyan
  2014-01-29 18:21 ` [PATCH 2/4] ppc 8xxx: Fix logic Alexander Shiyan
  2014-01-29 18:21 ` [PATCH 3/4] gadget: at91: Fix uninitialized variable Alexander Shiyan
@ 2014-01-29 18:21 ` Alexander Shiyan
  2014-01-29 20:39 ` [PATCH 1/4] MIPS: mach-ar231x: Fix uninitialized variable Sascha Hauer
  3 siblings, 0 replies; 6+ messages in thread
From: Alexander Shiyan @ 2014-01-29 18:21 UTC (permalink / raw)
  To: barebox

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 scripts/imx/imx-usb-loader.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c
index 12a89f5..475917b 100644
--- a/scripts/imx/imx-usb-loader.c
+++ b/scripts/imx/imx-usb-loader.c
@@ -1334,7 +1334,7 @@ static void usage(const char *prgname)
 
 int main(int argc, char *argv[])
 {
-	struct usb_id *p_id;
+	struct usb_id *p_id = NULL;
 	struct mach_id *mach;
 	libusb_device **devs;
 	libusb_device *dev;
@@ -1432,6 +1432,9 @@ int main(int argc, char *argv[])
 
 	ret = 0;
 out:
+	if (p_id)
+		free(p_id);
+
 	if (h)
 		libusb_close(h);
 
-- 
1.8.3.2


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

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

* Re: [PATCH 1/4] MIPS: mach-ar231x: Fix uninitialized variable
  2014-01-29 18:21 [PATCH 1/4] MIPS: mach-ar231x: Fix uninitialized variable Alexander Shiyan
                   ` (2 preceding siblings ...)
  2014-01-29 18:21 ` [PATCH 4/4] scripts: imx-usb-loader: Fix memory leak Alexander Shiyan
@ 2014-01-29 20:39 ` Sascha Hauer
  2014-01-30  6:39   ` Alexander Shiyan
  3 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2014-01-29 20:39 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

On Wed, Jan 29, 2014 at 10:21:46PM +0400, Alexander Shiyan wrote:
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>

Applied all, thanks.

Are you running sparse or how did you find all these?

Sascha

> ---
>  arch/mips/mach-ar231x/board.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/mips/mach-ar231x/board.c b/arch/mips/mach-ar231x/board.c
> index f1b876f..8bd1787 100644
> --- a/arch/mips/mach-ar231x/board.c
> +++ b/arch/mips/mach-ar231x/board.c
> @@ -111,7 +111,7 @@ static u16
>  ar231x_cksum16(u8 *data, int size)
>  {
>  	int i;
> -	u16 sum;
> +	u16 sum = 0;
>  
>  	for (i = 0; i < size; i++)
>  		sum += data[i];
> -- 
> 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] 6+ messages in thread

* Re: [PATCH 1/4] MIPS: mach-ar231x: Fix uninitialized variable
  2014-01-29 20:39 ` [PATCH 1/4] MIPS: mach-ar231x: Fix uninitialized variable Sascha Hauer
@ 2014-01-30  6:39   ` Alexander Shiyan
  0 siblings, 0 replies; 6+ messages in thread
From: Alexander Shiyan @ 2014-01-30  6:39 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Среда, 29 января 2014, 21:39 +01:00 от Sascha Hauer <s.hauer@pengutronix.de>:
> On Wed, Jan 29, 2014 at 10:21:46PM +0400, Alexander Shiyan wrote:
> > Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> 
> Applied all, thanks.
> 
> Are you running sparse or how did you find all these?

I use several tools for this purpose.
Basic tools are: coccinelle, cppcheck and my own script.

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

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

end of thread, other threads:[~2014-01-30  6:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-29 18:21 [PATCH 1/4] MIPS: mach-ar231x: Fix uninitialized variable Alexander Shiyan
2014-01-29 18:21 ` [PATCH 2/4] ppc 8xxx: Fix logic Alexander Shiyan
2014-01-29 18:21 ` [PATCH 3/4] gadget: at91: Fix uninitialized variable Alexander Shiyan
2014-01-29 18:21 ` [PATCH 4/4] scripts: imx-usb-loader: Fix memory leak Alexander Shiyan
2014-01-29 20:39 ` [PATCH 1/4] MIPS: mach-ar231x: Fix uninitialized variable Sascha Hauer
2014-01-30  6:39   ` Alexander Shiyan

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