diff options
author | Wolfram Sang <w.sang@pengutronix.de> | 2009-11-02 03:53:11 +0000 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2009-11-04 16:42:47 -0700 |
commit | f856cf01787354fb3c8cde0a80de606f368b21ed (patch) | |
tree | a69346d1f7f075f84d2c4efa682b8eeb202e2e0d /drivers/spi | |
parent | 3c9059d79f5eea6b8b75ddac97693127c3c41db4 (diff) | |
download | kernel_samsung_smdk4412-f856cf01787354fb3c8cde0a80de606f368b21ed.zip kernel_samsung_smdk4412-f856cf01787354fb3c8cde0a80de606f368b21ed.tar.gz kernel_samsung_smdk4412-f856cf01787354fb3c8cde0a80de606f368b21ed.tar.bz2 |
spi/mpc52xx-psc-spi: check for valid PSC
This driver calls mpc52xx_set_psc_clkdiv() but doesn't check its return value
to see if the PSC is actually valid for SPI use. Add the check and a hint for
the user.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/mpc52xx_psc_spi.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c index a14e9fd..2193d90 100644 --- a/drivers/spi/mpc52xx_psc_spi.c +++ b/drivers/spi/mpc52xx_psc_spi.c @@ -314,11 +314,13 @@ static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps) struct mpc52xx_psc __iomem *psc = mps->psc; struct mpc52xx_psc_fifo __iomem *fifo = mps->fifo; u32 mclken_div; - int ret = 0; + int ret; /* default sysclk is 512MHz */ mclken_div = (mps->sysclk ? mps->sysclk : 512000000) / MCLK; - mpc52xx_set_psc_clkdiv(psc_id, mclken_div); + ret = mpc52xx_set_psc_clkdiv(psc_id, mclken_div); + if (ret) + return ret; /* Reset the PSC into a known state */ out_8(&psc->command, MPC52xx_PSC_RST_RX); @@ -342,7 +344,7 @@ static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps) mps->bits_per_word = 8; - return ret; + return 0; } static irqreturn_t mpc52xx_psc_spi_isr(int irq, void *dev_id) @@ -411,8 +413,10 @@ static int __init mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr, goto free_master; ret = mpc52xx_psc_spi_port_config(master->bus_num, mps); - if (ret < 0) + if (ret < 0) { + dev_err(dev, "can't configure PSC! Is it capable of SPI?\n"); goto free_irq; + } spin_lock_init(&mps->lock); init_completion(&mps->done); |