Skip to content

Commit

Permalink
Merge tag 'spi-for-linus' of git://git.secretlab.ca/git/linux-2.6
Browse files Browse the repository at this point in the history
Pull SPI bug fixes from Grant Likely:
 "Miscellaneous driver bug fixes.  No major changes in this branch."

* tag 'spi-for-linus' of git://git.secretlab.ca/git/linux-2.6:
  spi/imx: prevent NULL pointer dereference in spi_imx_probe()
  spi/imx: mark base member in spi_imx_data as __iomem
  spi/mpc83xx: fix NULL pdata dereference bug
  spi/davinci: Fix DMA API usage in davinci
  spi/pL022: include types.h to remove compilation warnings
  • Loading branch information
Linus Torvalds committed Apr 13, 2012
2 parents 4166fb6 + 39ec0d3 commit cf7d8a5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
6 changes: 3 additions & 3 deletions drivers/spi/spi-davinci.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
dev_dbg(sdev, "Couldn't DMA map a %d bytes RX buffer\n",
rx_buf_count);
if (t->tx_buf)
dma_unmap_single(NULL, t->tx_dma, t->len,
dma_unmap_single(&spi->dev, t->tx_dma, t->len,
DMA_TO_DEVICE);
return -ENOMEM;
}
Expand Down Expand Up @@ -692,10 +692,10 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
if (spicfg->io_type == SPI_IO_TYPE_DMA) {

if (t->tx_buf)
dma_unmap_single(NULL, t->tx_dma, t->len,
dma_unmap_single(&spi->dev, t->tx_dma, t->len,
DMA_TO_DEVICE);

dma_unmap_single(NULL, t->rx_dma, rx_buf_count,
dma_unmap_single(&spi->dev, t->rx_dma, rx_buf_count,
DMA_FROM_DEVICE);

clear_io_bits(dspi->base + SPIINT, SPIINT_DMA_REQ_EN);
Expand Down
4 changes: 3 additions & 1 deletion drivers/spi/spi-fsl-spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,12 @@ static void fsl_spi_change_mode(struct spi_device *spi)
static void fsl_spi_chipselect(struct spi_device *spi, int value)
{
struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master);
struct fsl_spi_platform_data *pdata = spi->dev.parent->platform_data;
struct fsl_spi_platform_data *pdata;
bool pol = spi->mode & SPI_CS_HIGH;
struct spi_mpc8xxx_cs *cs = spi->controller_state;

pdata = spi->dev.parent->parent->platform_data;

if (value == BITBANG_CS_INACTIVE) {
if (pdata->cs_control)
pdata->cs_control(spi, !pol);
Expand Down
12 changes: 8 additions & 4 deletions drivers/spi/spi-imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ struct spi_imx_data {
struct spi_bitbang bitbang;

struct completion xfer_done;
void *base;
void __iomem *base;
int irq;
struct clk *clk;
unsigned long spi_clk;
Expand Down Expand Up @@ -766,8 +766,12 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
}

ret = of_property_read_u32(np, "fsl,spi-num-chipselects", &num_cs);
if (ret < 0)
num_cs = mxc_platform_info->num_chipselect;
if (ret < 0) {
if (mxc_platform_info)
num_cs = mxc_platform_info->num_chipselect;
else
return ret;
}

master = spi_alloc_master(&pdev->dev,
sizeof(struct spi_imx_data) + sizeof(int) * num_cs);
Expand All @@ -784,7 +788,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)

for (i = 0; i < master->num_chipselect; i++) {
int cs_gpio = of_get_named_gpio(np, "cs-gpios", i);
if (cs_gpio < 0)
if (cs_gpio < 0 && mxc_platform_info)
cs_gpio = mxc_platform_info->chipselect[i];

spi_imx->chipselect[i] = cs_gpio;
Expand Down
2 changes: 2 additions & 0 deletions include/linux/amba/pl022.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#ifndef _SSP_PL022_H
#define _SSP_PL022_H

#include <linux/types.h>

/**
* whether SSP is in loopback mode or not
*/
Expand Down

0 comments on commit cf7d8a5

Please sign in to comment.