From: Dan Carpenter <dan.carpenter@oracle.com>
To: s.grosjean@peak-system.com
Cc: linux-can@vger.kernel.org
Subject: [bug report] can: peak: add support for PEAK PCAN-PCIe FD CAN-FD boards
Date: Wed, 26 Apr 2017 22:22:09 +0300 [thread overview]
Message-ID: <20170426192209.3ae4mloolqbmr27m@mwanda> (raw)
Hello Stephane Grosjean,
The patch 8ac8321e4a79: "can: peak: add support for PEAK PCAN-PCIe FD
CAN-FD boards" from Jan 19, 2017, leads to the following static
checker warning:
drivers/net/can/peak_canfd/peak_canfd.c:402 pucan_handle_status()
error: uninitialized symbol 'cf'.
drivers/net/can/peak_canfd/peak_canfd.c
362 skb = alloc_can_err_skb(ndev, &cf);
^^
If skb is NULL "cf" is uninitialized.
363
364 /* test state error bits according to their priority */
365 if (pucan_status_is_busoff(msg)) {
366 netdev_dbg(ndev, "Bus-off entry status\n");
367 priv->can.state = CAN_STATE_BUS_OFF;
368 priv->can.can_stats.bus_off++;
369 can_bus_off(ndev);
370 if (skb)
371 cf->can_id |= CAN_ERR_BUSOFF;
372
373 } else if (pucan_status_is_passive(msg)) {
374 netdev_dbg(ndev, "Error passive status\n");
375 priv->can.state = CAN_STATE_ERROR_PASSIVE;
376 priv->can.can_stats.error_passive++;
377 if (skb) {
378 cf->can_id |= CAN_ERR_CRTL;
379 cf->data[1] = (priv->bec.txerr > priv->bec.rxerr) ?
380 CAN_ERR_CRTL_TX_PASSIVE :
381 CAN_ERR_CRTL_RX_PASSIVE;
382 cf->data[6] = priv->bec.txerr;
383 cf->data[7] = priv->bec.rxerr;
384 }
385
386 } else if (pucan_status_is_warning(msg)) {
387 netdev_dbg(ndev, "Error warning status\n");
388 priv->can.state = CAN_STATE_ERROR_WARNING;
389 priv->can.can_stats.error_warning++;
390 if (skb) {
391 cf->can_id |= CAN_ERR_CRTL;
392 cf->data[1] = (priv->bec.txerr > priv->bec.rxerr) ?
393 CAN_ERR_CRTL_TX_WARNING :
394 CAN_ERR_CRTL_RX_WARNING;
395 cf->data[6] = priv->bec.txerr;
396 cf->data[7] = priv->bec.rxerr;
397 }
398
399 } else if (priv->can.state != CAN_STATE_ERROR_ACTIVE) {
400 /* back to ERROR_ACTIVE */
401 netdev_dbg(ndev, "Error active status\n");
402 can_change_state(ndev, cf, CAN_STATE_ERROR_ACTIVE,
403 CAN_STATE_ERROR_ACTIVE);
Presumably we want an "if (skb) " here like we have on the other paths.
404 } else {
405 dev_kfree_skb(skb);
regards,
dan carpenter
next reply other threads:[~2017-04-26 19:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-26 19:22 Dan Carpenter [this message]
2017-05-02 11:07 ` [bug report] can: peak: add support for PEAK PCAN-PCIe FD CAN-FD boards Stephane Grosjean
2017-05-02 11:29 ` Oliver Hartkopp
-- strict thread matches above, loose matches on Subject: below --
2017-04-26 19:24 Dan Carpenter
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=20170426192209.3ae4mloolqbmr27m@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-can@vger.kernel.org \
--cc=s.grosjean@peak-system.com \
/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.