diff options
Diffstat (limited to 'drivers/net/wireless/ti/wlcore/spi.c')
-rw-r--r-- | drivers/net/wireless/ti/wlcore/spi.c | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index 53790d1d0d27..e26447832683 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -87,8 +87,11 @@ static void wl12xx_spi_reset(struct device *child) struct spi_message m; cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); - if (!cmd) + if (!cmd) { + dev_err(child->parent, + "could not allocate cmd for spi reset\n"); return; + } memset(&t, 0, sizeof(t)); spi_message_init(&m); @@ -112,8 +115,11 @@ static void wl12xx_spi_init(struct device *child) struct spi_message m; cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); - if (!cmd) + if (!cmd) { + dev_err(child->parent, + "could not allocate cmd for spi init\n"); return; + } memset(crc, 0, sizeof(crc)); memset(&t, 0, sizeof(t)); @@ -321,21 +327,28 @@ static struct wl1271_if_operations spi_ops = { static int wl1271_probe(struct spi_device *spi) { struct wl12xx_spi_glue *glue; - struct wl12xx_platform_data *pdata; + struct wlcore_platdev_data *pdev_data; struct resource res[1]; int ret = -ENOMEM; - pdata = spi->dev.platform_data; - if (!pdata) { + pdev_data = kzalloc(sizeof(*pdev_data), GFP_KERNEL); + if (!pdev_data) + goto out; + + pdev_data->pdata = spi->dev.platform_data; + if (!pdev_data->pdata) { dev_err(&spi->dev, "no platform data\n"); - return -ENODEV; + ret = -ENODEV; + goto out_free_pdev_data; } - pdata->ops = &spi_ops; + pdev_data->if_ops = &spi_ops; glue = kzalloc(sizeof(*glue), GFP_KERNEL); - if (!glue) - goto out; + if (!glue) { + dev_err(&spi->dev, "can't allocate glue\n"); + goto out_free_pdev_data; + } glue->dev = &spi->dev; @@ -351,7 +364,7 @@ static int wl1271_probe(struct spi_device *spi) goto out_free_glue; } - glue->core = platform_device_alloc("wl12xx", -1); + glue->core = platform_device_alloc("wl12xx", PLATFORM_DEVID_AUTO); if (!glue->core) { dev_err(glue->dev, "can't allocate platform_device\n"); ret = -ENOMEM; @@ -372,7 +385,8 @@ static int wl1271_probe(struct spi_device *spi) goto out_dev_put; } - ret = platform_device_add_data(glue->core, pdata, sizeof(*pdata)); + ret = platform_device_add_data(glue->core, pdev_data, + sizeof(*pdev_data)); if (ret) { dev_err(glue->dev, "can't add platform data\n"); goto out_dev_put; @@ -391,6 +405,10 @@ out_dev_put: out_free_glue: kfree(glue); + +out_free_pdev_data: + kfree(pdev_data); + out: return ret; } |