mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* mci/stm378x warning
@ 2011-01-31 13:34 Jean-Christophe PLAGNIOL-VILLARD
  2011-01-31 14:01 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-01-31 13:34 UTC (permalink / raw)
  To: Juergen Beisert; +Cc: barebox

HI,

	durring some night build I see this on the drivers/mci/stm378x.c

	/opt/work/barebox/drivers/mci/stm378x.c: In function 'mci_request':
	/opt/work/barebox/drivers/mci/stm378x.c:354: warning: 'length' may be used uninitialized in this function
	/opt/work/barebox/drivers/mci/stm378x.c:354: note: 'length' was declared here

	so I guess length will initialized at 0

Best Regards,
J.

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

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

* Re: mci/stm378x warning
  2011-01-31 13:34 mci/stm378x warning Jean-Christophe PLAGNIOL-VILLARD
@ 2011-01-31 14:01 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2011-01-31 14:01 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Mon, Jan 31, 2011 at 02:34:35PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> HI,
> 
> 	durring some night build I see this on the drivers/mci/stm378x.c
> 
> 	/opt/work/barebox/drivers/mci/stm378x.c: In function 'mci_request':
> 	/opt/work/barebox/drivers/mci/stm378x.c:354: warning: 'length' may be used uninitialized in this function
> 	/opt/work/barebox/drivers/mci/stm378x.c:354: note: 'length' was declared here
> 
> 	so I guess length will initialized at 0

That's a false positive:

> static int transfer_data(struct device_d *hw_dev, struct mci_data *data)
> {
> 	unsigned length;
> 
> 	if (data != NULL) {
> 		length = data->blocks * data->blocksize;
> 	}

When we have date length gets initialized...

> 
> 	/*
> 	 * Everything is ready for the transaction now:
> 	 * - transfer configuration
> 	 * - command and its parameters
> 	 *
> 	 * Start the transaction right now
> 	 */
> 	writel(SSP_CTRL0_RUN, hw_dev->map_base + HW_SSP_CTRL0 + 4);
> 
> 	if (data != NULL) {

...and is only used in the same case.

> 		if (data->flags & MMC_DATA_READ)
> 			return read_data(hw_dev, data->dest, length);
> 		else
> 			return write_data(hw_dev, data->src, length);
> 	}
> 
> 	return 0;

Anyway, we should silence the compiler somehow. I'll prepare a patch for
this.

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] 2+ messages in thread

end of thread, other threads:[~2011-01-31 14:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-31 13:34 mci/stm378x warning Jean-Christophe PLAGNIOL-VILLARD
2011-01-31 14:01 ` Sascha Hauer

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