From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [linux-next:master 11640/13394] drivers/net/can/usb/peak_usb/pcan_usb.c:852:9: warning: Variable 'pc' is modified but its new value is never used. [unreadVariable]
Date: Sat, 17 Apr 2021 13:30:09 +0800 [thread overview]
Message-ID: <202104171353.qtkCyK12-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 4735 bytes --]
CC: kbuild-all(a)lists.01.org
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: "Marc Kleine-Budde" <mkl@pengutronix.de>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 18250b538735142307082e4e99e3ae5c12d44013
commit: bd573ea5720470d1ea70f3e39fb2e2efad219311 [11640/13394] can: peak_usb: pcan_usb: replace open coded endianness conversion of unaligned data
:::::: branch date: 18 hours ago
:::::: commit date: 4 days ago
compiler: h8300-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> drivers/net/can/usb/peak_usb/pcan_usb.c:852:9: warning: Variable 'pc' is modified but its new value is never used. [unreadVariable]
pc += cf->len;
^
vim +/pc +852 drivers/net/can/usb/peak_usb/pcan_usb.c
46be265d338833 Stephane Grosjean 2012-03-02 812
46be265d338833 Stephane Grosjean 2012-03-02 813 /*
46be265d338833 Stephane Grosjean 2012-03-02 814 * process outgoing packet
46be265d338833 Stephane Grosjean 2012-03-02 815 */
46be265d338833 Stephane Grosjean 2012-03-02 816 static int pcan_usb_encode_msg(struct peak_usb_device *dev, struct sk_buff *skb,
46be265d338833 Stephane Grosjean 2012-03-02 817 u8 *obuf, size_t *size)
46be265d338833 Stephane Grosjean 2012-03-02 818 {
46be265d338833 Stephane Grosjean 2012-03-02 819 struct net_device *netdev = dev->netdev;
46be265d338833 Stephane Grosjean 2012-03-02 820 struct net_device_stats *stats = &netdev->stats;
46be265d338833 Stephane Grosjean 2012-03-02 821 struct can_frame *cf = (struct can_frame *)skb->data;
46be265d338833 Stephane Grosjean 2012-03-02 822 u8 *pc;
46be265d338833 Stephane Grosjean 2012-03-02 823
46be265d338833 Stephane Grosjean 2012-03-02 824 obuf[0] = 2;
46be265d338833 Stephane Grosjean 2012-03-02 825 obuf[1] = 1;
46be265d338833 Stephane Grosjean 2012-03-02 826
46be265d338833 Stephane Grosjean 2012-03-02 827 pc = obuf + PCAN_USB_MSG_HEADER_LEN;
46be265d338833 Stephane Grosjean 2012-03-02 828
46be265d338833 Stephane Grosjean 2012-03-02 829 /* status/len byte */
4c01fc87675e69 Oliver Hartkopp 2020-11-11 830 *pc = can_get_cc_dlc(cf, dev->can.ctrlmode);
4c01fc87675e69 Oliver Hartkopp 2020-11-11 831
46be265d338833 Stephane Grosjean 2012-03-02 832 if (cf->can_id & CAN_RTR_FLAG)
46be265d338833 Stephane Grosjean 2012-03-02 833 *pc |= PCAN_USB_STATUSLEN_RTR;
46be265d338833 Stephane Grosjean 2012-03-02 834
46be265d338833 Stephane Grosjean 2012-03-02 835 /* can id */
46be265d338833 Stephane Grosjean 2012-03-02 836 if (cf->can_id & CAN_EFF_FLAG) {
46be265d338833 Stephane Grosjean 2012-03-02 837 *pc |= PCAN_USB_STATUSLEN_EXT_ID;
bd573ea5720470 Marc Kleine-Budde 2021-04-05 838 pc++;
bd573ea5720470 Marc Kleine-Budde 2021-04-05 839
bd573ea5720470 Marc Kleine-Budde 2021-04-05 840 put_unaligned_le32((cf->can_id & CAN_ERR_MASK) << 3, pc);
46be265d338833 Stephane Grosjean 2012-03-02 841 pc += 4;
46be265d338833 Stephane Grosjean 2012-03-02 842 } else {
bd573ea5720470 Marc Kleine-Budde 2021-04-05 843 pc++;
46be265d338833 Stephane Grosjean 2012-03-02 844
bd573ea5720470 Marc Kleine-Budde 2021-04-05 845 put_unaligned_le16((cf->can_id & CAN_ERR_MASK) << 5, pc);
46be265d338833 Stephane Grosjean 2012-03-02 846 pc += 2;
46be265d338833 Stephane Grosjean 2012-03-02 847 }
46be265d338833 Stephane Grosjean 2012-03-02 848
46be265d338833 Stephane Grosjean 2012-03-02 849 /* can data */
46be265d338833 Stephane Grosjean 2012-03-02 850 if (!(cf->can_id & CAN_RTR_FLAG)) {
c7b74967799b1a Oliver Hartkopp 2020-11-20 851 memcpy(pc, cf->data, cf->len);
c7b74967799b1a Oliver Hartkopp 2020-11-20 @852 pc += cf->len;
46be265d338833 Stephane Grosjean 2012-03-02 853 }
46be265d338833 Stephane Grosjean 2012-03-02 854
46be265d338833 Stephane Grosjean 2012-03-02 855 obuf[(*size)-1] = (u8)(stats->tx_packets & 0xff);
46be265d338833 Stephane Grosjean 2012-03-02 856
46be265d338833 Stephane Grosjean 2012-03-02 857 return 0;
46be265d338833 Stephane Grosjean 2012-03-02 858 }
46be265d338833 Stephane Grosjean 2012-03-02 859
:::::: The code at line 852 was first introduced by commit
:::::: c7b74967799b1af52b3045d69d4c26836b2d41de can: replace can_dlc as variable/element for payload length
:::::: TO: Oliver Hartkopp <socketcan@hartkopp.net>
:::::: CC: Marc Kleine-Budde <mkl@pengutronix.de>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
reply other threads:[~2021-04-17 5:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202104171353.qtkCyK12-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.