Thread (9 messages) 9 messages, 3 authors, 2017-04-04

Re: [PATCH v4 2/2] can: spi: hi311x: Add Holt HI-311x CAN driver

From: Marc Kleine-Budde <hidden>
Date: 2017-04-04 15:34:24
Also in: linux-can, linux-devicetree, lkml

On 03/24/2017 06:20 PM, Akshay Bhat wrote:
Hi Marc,

On 03/17/2017 05:10 PM, Akshay Bhat wrote:
quoted
This patch adds support for the Holt HI-311x CAN controller. The HI311x
CAN controller is capable of transmitting and receiving standard data
frames, extended data frames and remote frames. The HI311x interfaces
with the host over SPI.

Datasheet: www.holtic.com/documents/371-hi-3110_v-rev-jpdf.do

Signed-off-by: Akshay Bhat <redacted>
---
If there are no further review comments can this series be applied to
can-next or does it need to wait for the next kernel release cycle (4.13)?
The driver doesn't check if the workqueue allocation is successfull,
I've squashed this patch:
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/can/spi/hi311x.c b/drivers/net/can/spi/hi311x.c
index ff4bb40d855e..170e8e3971b2 100644
--- a/drivers/net/can/spi/hi311x.c
+++ b/drivers/net/can/spi/hi311x.c
@@ -780,20 +780,24 @@ static int hi3110_open(struct net_device *net)
 
        priv->wq = alloc_workqueue("hi3110_wq", WQ_FREEZABLE | WQ_MEM_RECLAIM,
                                   0);
+       if (!priv->wq) {
+               ret = -ENOMEM;
+               goto out_free_irq;
+       }
        INIT_WORK(&priv->tx_work, hi3110_tx_work_handler);
        INIT_WORK(&priv->restart_work, hi3110_restart_work_handler);
 
        ret = hi3110_hw_reset(spi);
        if (ret)
-               goto out_free_irq;
+               goto out_free_wq;
 
        ret = hi3110_setup(net);
        if (ret)
-               goto out_free_irq;
+               goto out_free_wq;
 
        ret = hi3110_set_normal_mode(spi);
        if (ret)
-               goto out_free_irq;
+               goto out_free_wq;
 
        can_led_event(net, CAN_LED_EVENT_OPEN);
        netif_wake_queue(net);
@@ -801,11 +805,12 @@ static int hi3110_open(struct net_device *net)
 
        return 0;
 
-out_free_irq:
+ out_free_wq:
+       destroy_workqueue(priv->wq);
+ out_free_irq:
        free_irq(spi->irq, priv);
        hi3110_hw_sleep(spi);
-
-out_close:
+ out_close:
        hi3110_power_enable(priv->transceiver, 0);
        close_candev(net);
        mutex_unlock(&priv->hi3110_lock);
Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help