linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alexander Shiyan" <shc_work@mail.ru>
To: "Marc Kleine-Budde" <mkl@pengutronix.de>
Cc: "Wolfgang Grandegger" <wg@grandegger.com>, linux-can@vger.kernel.org
Subject: Re: [PATCH 1/4] can: mcp251x: Check return value of spi_setup()
Date: Tue, 01 Apr 2014 16:47:31 +0400	[thread overview]
Message-ID: <1396356451.825797457@f388.i.mail.ru> (raw)
In-Reply-To: <533AA979.9060201@pengutronix.de>

Tue, 01 Apr 2014 13:56:41 +0200 от Marc Kleine-Budde <mkl@pengutronix.de>:
> On 03/28/2014 11:14 AM, Alexander Shiyan wrote:
> > This patch moves setup of SPI bus a bit earlier and adds check
> > for spi_setup() result to be sure SPI bus is communicated with the
> > device properly.
> > 
> > Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> > ---
> >  drivers/net/can/mcp251x.c | 25 +++++++++++++------------
> >  1 file changed, 13 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
> > index 28c11f8..26879c7 100644
> > --- a/drivers/net/can/mcp251x.c
> > +++ b/drivers/net/can/mcp251x.c
> > @@ -1032,8 +1032,8 @@ static int mcp251x_can_probe(struct spi_device *spi)
> >  	struct mcp251x_platform_data *pdata = dev_get_platdata(&spi->dev);
> >  	struct net_device *net;
> >  	struct mcp251x_priv *priv;
> > -	int freq, ret = -ENODEV;
> >  	struct clk *clk;
> > +	int freq, ret;
> >  
> >  	clk = devm_clk_get(&spi->dev, NULL);
> >  	if (IS_ERR(clk)) {
> > @@ -1076,6 +1076,18 @@ static int mcp251x_can_probe(struct spi_device *spi)
> >  	priv->net = net;
> >  	priv->clk = clk;
> >  
> > +	spi_set_drvdata(spi, priv);
> > +
> > +	/* Configure the SPI bus */
> > +	spi->bits_per_word = 8;
> > +	if (mcp251x_is_2510(spi))
> > +		spi->max_speed_hz = spi->max_speed_hz ? : 5 * 1000 * 1000;
> > +	else
> > +		spi->max_speed_hz = spi->max_speed_hz ? : 10 * 1000 * 1000;
> > +	ret = spi_setup(spi);
> > +	if (ret)
> > +		return ret;
> 
> You're omitting the error handling here. I'll send a v2.

spi_setup() returns 0 or an error. What is wrong here?

---


  reply	other threads:[~2014-04-01 12:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-28 10:14 [PATCH 1/4] can: mcp251x: Check return value of spi_setup() Alexander Shiyan
2014-03-28 10:14 ` [PATCH 2/4] can: mcp251x: Improve mcp251x_hw_reset() Alexander Shiyan
2014-04-01 20:47   ` Marc Kleine-Budde
2014-03-28 10:14 ` [PATCH 3/4] can: mcp251x: Improve mcp251x_hw_probe() Alexander Shiyan
2014-04-01 20:46   ` Marc Kleine-Budde
2014-03-28 10:14 ` [PATCH 4/4] can: mcp251x: Remove unnecessary power disabling Alexander Shiyan
2014-04-01 20:36   ` Marc Kleine-Budde
2014-04-02  6:17     ` Alexander Shiyan
2014-04-02  7:05       ` Marc Kleine-Budde
2014-04-01 11:56 ` [PATCH 1/4] can: mcp251x: Check return value of spi_setup() Marc Kleine-Budde
2014-04-01 12:47   ` Alexander Shiyan [this message]
2014-04-01 12:49     ` Marc Kleine-Budde
2014-04-01 12:54       ` Alexander Shiyan
2014-04-01 20:40         ` Marc Kleine-Budde

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=1396356451.825797457@f388.i.mail.ru \
    --to=shc_work@mail.ru \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=wg@grandegger.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;
as well as URLs for NNTP newsgroup(s).