Skip to content

Commit

Permalink
can: peak_usb: pcan_usb_{,pro}_get_device_id(): remove unneeded check…
Browse files Browse the repository at this point in the history
… for device_id

The callback struct peak_usb_adapter::dev_get_device_id, which is
implemented by the functions pcan_usb_{,pro}_get_device_id() is only
ever called with a valid device_id pointer.

This patch removes the unneeded check if the device_id pointer is
valid.

Link: https://lore.kernel.org/r/20210406111622.1874957-7-mkl@pengutronix.de
Acked-by: Stephane Grosjean <s.grosjean@peak-system.com>
Tested-by: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
  • Loading branch information
Marc Kleine-Budde committed Apr 13, 2021
1 parent 592bf5a commit 426718f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions drivers/net/can/usb/peak_usb/pcan_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ static int pcan_usb_get_device_id(struct peak_usb_device *dev, u32 *device_id)
err = pcan_usb_wait_rsp(dev, PCAN_USB_CMD_DEVID, PCAN_USB_GET, args);
if (err)
netdev_err(dev->netdev, "getting device id failure: %d\n", err);
else if (device_id)
*device_id = args[0];

*device_id = args[0];

return err;
}
Expand Down
3 changes: 1 addition & 2 deletions drivers/net/can/usb/peak_usb/pcan_usb_pro.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,7 @@ static int pcan_usb_pro_get_device_id(struct peak_usb_device *dev,
return err;

pdn = (struct pcan_usb_pro_devid *)pc;
if (device_id)
*device_id = le32_to_cpu(pdn->serial_num);
*device_id = le32_to_cpu(pdn->serial_num);

return err;
}
Expand Down

0 comments on commit 426718f

Please sign in to comment.