mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: mci/stm378x warning
Date: Mon, 31 Jan 2011 15:01:23 +0100	[thread overview]
Message-ID: <20110131140122.GO9041@pengutronix.de> (raw)
In-Reply-To: <20110131133435.GE26656@game.jcrosoft.org>

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

      reply	other threads:[~2011-01-31 14:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-31 13:34 Jean-Christophe PLAGNIOL-VILLARD
2011-01-31 14:01 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110131140122.GO9041@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox