Commit 9bd9fa6c authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'hsi-for-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi

Pull HSI updates from Sebastian Reichel:
 "Misc fixes"

* tag 'hsi-for-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi:
  hsi: controllers:remove redundant code
  hsi: correctly handle return value of kzalloc
  hsi: omap_ssi_port: Prevent warning if cawake_gpio is not defined.
  hsi: fix double kfree
  HSI: Fix a typo
parents b0378657 16bd5865
...@@ -783,7 +783,7 @@ static void ssip_rx_strans(struct hsi_client *cl, u32 cmd) ...@@ -783,7 +783,7 @@ static void ssip_rx_strans(struct hsi_client *cl, u32 cmd)
} }
ssip_set_rxstate(ssi, RECEIVING); ssip_set_rxstate(ssi, RECEIVING);
if (unlikely(SSIP_MSG_ID(cmd) != ssi->rxid)) { if (unlikely(SSIP_MSG_ID(cmd) != ssi->rxid)) {
dev_err(&cl->device, "START TRANS id %d expeceted %d\n", dev_err(&cl->device, "START TRANS id %d expected %d\n",
SSIP_MSG_ID(cmd), ssi->rxid); SSIP_MSG_ID(cmd), ssi->rxid);
spin_unlock(&ssi->lock); spin_unlock(&ssi->lock);
goto out1; goto out1;
......
...@@ -295,27 +295,14 @@ static int __init ssi_get_iomem(struct platform_device *pd, ...@@ -295,27 +295,14 @@ static int __init ssi_get_iomem(struct platform_device *pd,
const char *name, void __iomem **pbase, dma_addr_t *phy) const char *name, void __iomem **pbase, dma_addr_t *phy)
{ {
struct resource *mem; struct resource *mem;
struct resource *ioarea;
void __iomem *base; void __iomem *base;
struct hsi_controller *ssi = platform_get_drvdata(pd); struct hsi_controller *ssi = platform_get_drvdata(pd);
mem = platform_get_resource_byname(pd, IORESOURCE_MEM, name); mem = platform_get_resource_byname(pd, IORESOURCE_MEM, name);
if (!mem) { base = devm_ioremap_resource(&ssi->device, mem);
dev_err(&pd->dev, "IO memory region missing (%s)\n", name); if (IS_ERR(base))
return -ENXIO; return PTR_ERR(base);
}
ioarea = devm_request_mem_region(&ssi->device, mem->start,
resource_size(mem), dev_name(&pd->dev));
if (!ioarea) {
dev_err(&pd->dev, "%s IO memory region request failed\n",
mem->name);
return -ENXIO;
}
base = devm_ioremap(&ssi->device, mem->start, resource_size(mem));
if (!base) {
dev_err(&pd->dev, "%s IO remap failed\n", mem->name);
return -ENXIO;
}
*pbase = base; *pbase = base;
if (phy) if (phy)
......
...@@ -1111,7 +1111,7 @@ static int __init ssi_port_probe(struct platform_device *pd) ...@@ -1111,7 +1111,7 @@ static int __init ssi_port_probe(struct platform_device *pd)
struct omap_ssi_port *omap_port; struct omap_ssi_port *omap_port;
struct hsi_controller *ssi = dev_get_drvdata(pd->dev.parent); struct hsi_controller *ssi = dev_get_drvdata(pd->dev.parent);
struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi); struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi);
u32 cawake_gpio = 0; int cawake_gpio = 0;
u32 port_id; u32 port_id;
int err; int err;
......
...@@ -85,12 +85,14 @@ struct hsi_client *hsi_new_client(struct hsi_port *port, ...@@ -85,12 +85,14 @@ struct hsi_client *hsi_new_client(struct hsi_port *port,
cl = kzalloc(sizeof(*cl), GFP_KERNEL); cl = kzalloc(sizeof(*cl), GFP_KERNEL);
if (!cl) if (!cl)
return NULL; goto err;
cl->tx_cfg = info->tx_cfg; cl->tx_cfg = info->tx_cfg;
if (cl->tx_cfg.channels) { if (cl->tx_cfg.channels) {
size = cl->tx_cfg.num_channels * sizeof(*cl->tx_cfg.channels); size = cl->tx_cfg.num_channels * sizeof(*cl->tx_cfg.channels);
cl->tx_cfg.channels = kzalloc(size , GFP_KERNEL); cl->tx_cfg.channels = kzalloc(size , GFP_KERNEL);
if (!cl->tx_cfg.channels)
goto err_tx;
memcpy(cl->tx_cfg.channels, info->tx_cfg.channels, size); memcpy(cl->tx_cfg.channels, info->tx_cfg.channels, size);
} }
...@@ -98,6 +100,8 @@ struct hsi_client *hsi_new_client(struct hsi_port *port, ...@@ -98,6 +100,8 @@ struct hsi_client *hsi_new_client(struct hsi_port *port,
if (cl->rx_cfg.channels) { if (cl->rx_cfg.channels) {
size = cl->rx_cfg.num_channels * sizeof(*cl->rx_cfg.channels); size = cl->rx_cfg.num_channels * sizeof(*cl->rx_cfg.channels);
cl->rx_cfg.channels = kzalloc(size , GFP_KERNEL); cl->rx_cfg.channels = kzalloc(size , GFP_KERNEL);
if (!cl->rx_cfg.channels)
goto err_rx;
memcpy(cl->rx_cfg.channels, info->rx_cfg.channels, size); memcpy(cl->rx_cfg.channels, info->rx_cfg.channels, size);
} }
...@@ -114,6 +118,12 @@ struct hsi_client *hsi_new_client(struct hsi_port *port, ...@@ -114,6 +118,12 @@ struct hsi_client *hsi_new_client(struct hsi_port *port,
} }
return cl; return cl;
err_rx:
kfree(cl->tx_cfg.channels);
err_tx:
kfree(cl);
err:
return NULL;
} }
EXPORT_SYMBOL_GPL(hsi_new_client); EXPORT_SYMBOL_GPL(hsi_new_client);
...@@ -300,7 +310,6 @@ static void hsi_add_client_from_dt(struct hsi_port *port, ...@@ -300,7 +310,6 @@ static void hsi_add_client_from_dt(struct hsi_port *port,
if (device_register(&cl->device) < 0) { if (device_register(&cl->device) < 0) {
pr_err("hsi: failed to register client: %s\n", name); pr_err("hsi: failed to register client: %s\n", name);
put_device(&cl->device); put_device(&cl->device);
goto err3;
} }
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment