Skip to contentSkip to conversation

mci/stm378x warning

DISCUSSION Jean-Christophe PLAGNIOL-VILLARD 2 participants 2 messages Jan 31, 2011

lore
Share & tools
lore
#0 lore raw

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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#1 lore raw
Quoted 9 lines · Jean-Christophe PLAGNIOL-VILLARD

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:

Quoted 7 lines

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...

Quoted 11 lines
	/*
	 * 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.

Quoted 7 lines
		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

Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox