Commit f6d4c713 authored by David S. Miller's avatar David S. Miller

Merge tag 'linux-can-fixes-for-4.12-20170609' of...

Merge tag 'linux-can-fixes-for-4.12-20170609' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can

Marc Kleine-Budde says:

====================
pull-request: can 2017-06-09

this is a pull request of 6 patches for net/master.

There's a patch by Stephane Grosjean that fixes an uninitialized symbol warning
in the peak_canfd driver. A patch by Johan Hovold to fix the product-id
endianness in an error message in the the peak_usb driver. A patch by Oliver
Hartkopp to enable CAN FD for virtual CAN devices by default. Three patches by
me, one makes the helper function can_change_state() robust to be called with
cf == NULL. The next patch fixes a memory leak in the gs_usb driver. And the
last one fixes a lockdep splat by properly initialize the per-net
can_rcvlists_lock spin_lock.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c7a61cba 97edec3a
...@@ -391,6 +391,9 @@ void can_change_state(struct net_device *dev, struct can_frame *cf, ...@@ -391,6 +391,9 @@ void can_change_state(struct net_device *dev, struct can_frame *cf,
can_update_state_error_stats(dev, new_state); can_update_state_error_stats(dev, new_state);
priv->state = new_state; priv->state = new_state;
if (!cf)
return;
if (unlikely(new_state == CAN_STATE_BUS_OFF)) { if (unlikely(new_state == CAN_STATE_BUS_OFF)) {
cf->can_id |= CAN_ERR_BUSOFF; cf->can_id |= CAN_ERR_BUSOFF;
return; return;
......
...@@ -489,7 +489,7 @@ int peak_canfd_handle_msgs_list(struct peak_canfd_priv *priv, ...@@ -489,7 +489,7 @@ int peak_canfd_handle_msgs_list(struct peak_canfd_priv *priv,
struct pucan_rx_msg *msg_list, int msg_count) struct pucan_rx_msg *msg_list, int msg_count)
{ {
void *msg_ptr = msg_list; void *msg_ptr = msg_list;
int i, msg_size; int i, msg_size = 0;
for (i = 0; i < msg_count; i++) { for (i = 0; i < msg_count; i++) {
msg_size = peak_canfd_handle_msg(priv, msg_ptr); msg_size = peak_canfd_handle_msg(priv, msg_ptr);
......
...@@ -265,6 +265,8 @@ static int gs_cmd_reset(struct gs_usb *gsusb, struct gs_can *gsdev) ...@@ -265,6 +265,8 @@ static int gs_cmd_reset(struct gs_usb *gsusb, struct gs_can *gsdev)
sizeof(*dm), sizeof(*dm),
1000); 1000);
kfree(dm);
return rc; return rc;
} }
......
...@@ -908,8 +908,6 @@ static int peak_usb_probe(struct usb_interface *intf, ...@@ -908,8 +908,6 @@ static int peak_usb_probe(struct usb_interface *intf,
const struct peak_usb_adapter *peak_usb_adapter = NULL; const struct peak_usb_adapter *peak_usb_adapter = NULL;
int i, err = -ENOMEM; int i, err = -ENOMEM;
usb_dev = interface_to_usbdev(intf);
/* get corresponding PCAN-USB adapter */ /* get corresponding PCAN-USB adapter */
for (i = 0; i < ARRAY_SIZE(peak_usb_adapters_list); i++) for (i = 0; i < ARRAY_SIZE(peak_usb_adapters_list); i++)
if (peak_usb_adapters_list[i]->device_id == usb_id_product) { if (peak_usb_adapters_list[i]->device_id == usb_id_product) {
...@@ -920,7 +918,7 @@ static int peak_usb_probe(struct usb_interface *intf, ...@@ -920,7 +918,7 @@ static int peak_usb_probe(struct usb_interface *intf,
if (!peak_usb_adapter) { if (!peak_usb_adapter) {
/* should never come except device_id bad usage in this file */ /* should never come except device_id bad usage in this file */
pr_err("%s: didn't find device id. 0x%x in devices list\n", pr_err("%s: didn't find device id. 0x%x in devices list\n",
PCAN_USB_DRIVER_NAME, usb_dev->descriptor.idProduct); PCAN_USB_DRIVER_NAME, usb_id_product);
return -ENODEV; return -ENODEV;
} }
......
...@@ -152,7 +152,7 @@ static const struct net_device_ops vcan_netdev_ops = { ...@@ -152,7 +152,7 @@ static const struct net_device_ops vcan_netdev_ops = {
static void vcan_setup(struct net_device *dev) static void vcan_setup(struct net_device *dev)
{ {
dev->type = ARPHRD_CAN; dev->type = ARPHRD_CAN;
dev->mtu = CAN_MTU; dev->mtu = CANFD_MTU;
dev->hard_header_len = 0; dev->hard_header_len = 0;
dev->addr_len = 0; dev->addr_len = 0;
dev->tx_queue_len = 0; dev->tx_queue_len = 0;
......
...@@ -150,7 +150,7 @@ static const struct net_device_ops vxcan_netdev_ops = { ...@@ -150,7 +150,7 @@ static const struct net_device_ops vxcan_netdev_ops = {
static void vxcan_setup(struct net_device *dev) static void vxcan_setup(struct net_device *dev)
{ {
dev->type = ARPHRD_CAN; dev->type = ARPHRD_CAN;
dev->mtu = CAN_MTU; dev->mtu = CANFD_MTU;
dev->hard_header_len = 0; dev->hard_header_len = 0;
dev->addr_len = 0; dev->addr_len = 0;
dev->tx_queue_len = 0; dev->tx_queue_len = 0;
......
...@@ -872,8 +872,7 @@ static int can_notifier(struct notifier_block *nb, unsigned long msg, ...@@ -872,8 +872,7 @@ static int can_notifier(struct notifier_block *nb, unsigned long msg,
static int can_pernet_init(struct net *net) static int can_pernet_init(struct net *net)
{ {
net->can.can_rcvlists_lock = spin_lock_init(&net->can.can_rcvlists_lock);
__SPIN_LOCK_UNLOCKED(net->can.can_rcvlists_lock);
net->can.can_rx_alldev_list = net->can.can_rx_alldev_list =
kzalloc(sizeof(struct dev_rcv_lists), GFP_KERNEL); kzalloc(sizeof(struct dev_rcv_lists), GFP_KERNEL);
......
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