devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhou Wang <wangzhou1-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>
To: Brian Norris <computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	xuwei5-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	caizhiyong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org,
	yubingxu-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org,
	liguozhu-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org
Subject: Re: [PATCH v6 1/2] mtd: hisilicon: add a new NAND controller driver for hisilicon hip04 Soc
Date: Wed, 14 Jan 2015 20:45:05 +0800	[thread overview]
Message-ID: <54B664D1.6060508@hisilicon.com> (raw)
In-Reply-To: <20150113040254.GK9759@ld-irv-0074>

On 2015/1/13 12:02, Brian Norris wrote:
> One more thing:
> 
> On Mon, Jan 12, 2015 at 03:28:53PM +0800, Zhou Wang wrote:
>> diff --git a/drivers/mtd/nand/hisi504_nand.c b/drivers/mtd/nand/hisi504_nand.c
>> new file mode 100644
>> index 0000000..2000f21
>> --- /dev/null
>> +++ b/drivers/mtd/nand/hisi504_nand.c
> ...
>> +static int hisi_nand_read_page_hwecc(struct mtd_info *mtd,
>> +	struct nand_chip *chip, uint8_t *buf, int oob_required, int page)
>> +{
>> +	struct hinfc_host *host = chip->priv;
>> +	int max_bitflips = 0, stat = 0, stat_max, status_ecc;
> 
>     drivers/mtd/nand/hisi504_nand.c:547:34: warning: ‘stat_max’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>       int max_bitflips = 0, stat = 0, stat_max, status_ecc;

In fact, there is no chance to run "default case" there as hisi_nfc_ecc_probe
will check this and print error.
I will initialize stat_max with 0 to eliminate this warning.

>                                       ^
> 
>> +	int stat_1, stat_2;
>> +
>> +	chip->read_buf(mtd, buf, mtd->writesize);
>> +	chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
>> +
>> +	/* errors which can not be corrected by ECC */
>> +	if (host->irq_status & HINFC504_INTS_UE) {
>> +		mtd->ecc_stats.failed++;
>> +	} else if (host->irq_status & HINFC504_INTS_CE) {
>> +		/* TODO: need add other ECC modes! */
> 
> You may want a 'default' case that sets stat_max to zero, then.
> 
>> +		switch (chip->ecc.strength) {
>> +		case 1:
>> +			stat = hweight8(hinfc_read(host, HINFC504_ECC_STATUS)>>
>> +						HINFC504_ECC_1_BIT_SHIFT);
>> +			stat_max = 1;
>> +			break;
>> +		case 16:
>> +			status_ecc = hinfc_read(host, HINFC504_ECC_STATUS) >>
>> +					HINFC504_ECC_16_BIT_SHIFT & 0x0fff;
>> +			stat_2 = status_ecc & 0x3f;
>> +			stat_1 = status_ecc >> 6 & 0x3f;
>> +			stat = stat_1 + stat_2;
>> +			stat_max = max_t(int, stat_1, stat_2);
>> +		}
>> +		mtd->ecc_stats.corrected += stat;
>> +		max_bitflips = max_t(int, max_bitflips, stat_max);
>> +	}
>> +	host->irq_status = 0;
>> +
>> +	return max_bitflips;
>> +}
> 
> Brian

Thanks for your comment!
Zhou Wang
> 
> .
> 


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2015-01-14 12:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-12  7:28 [PATCH v6 0/2] mtd: hisilicon: add a new driver for NAND controller of hisilicon hip04 Soc Zhou Wang
     [not found] ` <1421047734-30818-1-git-send-email-wangzhou1-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>
2015-01-12  7:28   ` [PATCH v6 1/2] mtd: hisilicon: add a new NAND controller driver for " Zhou Wang
     [not found]     ` <1421047734-30818-2-git-send-email-wangzhou1-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>
2015-01-12  8:21       ` Arnd Bergmann
2015-01-12  9:18         ` Zhou Wang
2015-01-13  3:58       ` Brian Norris
2015-01-14 12:34         ` Zhou Wang
     [not found]           ` <54B6625F.8060607-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>
2015-01-14 19:25             ` Brian Norris
2015-01-15  1:27               ` Zhou Wang
2015-01-13  4:02       ` Brian Norris
2015-01-14 12:45         ` Zhou Wang [this message]
2015-01-12  7:28   ` [PATCH v6 2/2] mtd: hisilicon: add device tree binding documentation Zhou Wang

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=54B664D1.6060508@hisilicon.com \
    --to=wangzhou1-c8/m+/jpzteamjb+lgu22q@public.gmane.org \
    --cc=caizhiyong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
    --cc=computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=liguozhu-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=xuwei5-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org \
    --cc=yubingxu-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).