public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Graham Moore <grmoore@opensource.altera.com>
Cc: Brian Norris <computersforpeace@gmail.com>,
	linux-mtd@lists.infradead.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch 2/2] mtd: spi-nor: Fix some error codes in cqspi_setup_flash()
Date: Fri, 14 Oct 2016 09:16:23 +0200	[thread overview]
Message-ID: <3ebab16e-ddf8-0a4b-aaaf-d5b424720eb2@denx.de> (raw)
In-Reply-To: <20161013080857.GC3389@mwanda>

On 10/13/2016 10:30 AM, Dan Carpenter wrote:
> We return success or possibly uninitialized values on these error paths
> instead of proper error codes.
> 
> Fixes: 140623410536 ("mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 

Nice

Reviewed-by: Marek Vasut <marex@denx.de>

> diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
> index 944863b..d489fbd 100644
> --- a/drivers/mtd/spi-nor/cadence-quadspi.c
> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c
> @@ -1077,12 +1077,14 @@ static int cqspi_setup_flash(struct cqspi_st *cqspi, struct device_node *np)
>  
>  	/* Get flash device data */
>  	for_each_available_child_of_node(dev->of_node, np) {
> -		if (of_property_read_u32(np, "reg", &cs)) {
> +		ret = of_property_read_u32(np, "reg", &cs);
> +		if (ret) {
>  			dev_err(dev, "Couldn't determine chip select.\n");
>  			goto err;
>  		}
>  
>  		if (cs >= CQSPI_MAX_CHIPSELECT) {
> +			ret = -EINVAL;
>  			dev_err(dev, "Chip select %d out of range.\n", cs);
>  			goto err;
>  		}
> 


-- 
Best regards,
Marek Vasut

  reply	other threads:[~2016-10-14  9:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-13  8:30 [patch 2/2] mtd: spi-nor: Fix some error codes in cqspi_setup_flash() Dan Carpenter
2016-10-14  7:16 ` Marek Vasut [this message]
2016-10-15 22:09   ` Moritz Fischer
2016-11-28  8:20     ` Cyrille Pitchen

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=3ebab16e-ddf8-0a4b-aaaf-d5b424720eb2@denx.de \
    --to=marex@denx.de \
    --cc=computersforpeace@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dwmw2@infradead.org \
    --cc=grmoore@opensource.altera.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.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