Linux CAN drivers development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: mkl@pengutronix.de
Cc: linux-can@vger.kernel.org
Subject: [bug report] can: mcp25xxfd: add driver for Microchip MCP25xxFD SPI CAN
Date: Wed, 23 Sep 2020 14:29:17 +0300	[thread overview]
Message-ID: <20200923112917.GB1473821@mwanda> (raw)

Hello Marc Kleine-Budde,

The patch 55e5b97f003e: "can: mcp25xxfd: add driver for Microchip
MCP25xxFD SPI CAN" from Sep 18, 2020, leads to the following static
checker warning:

	drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c:2155 mcp25xxfd_irq()
	error: uninitialized symbol 'set_normal_mode'.

drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
  2074          do {
  2075                  u32 intf_pending, intf_pending_clearable;
  2076                  bool set_normal_mode;
                        ^^^^^^^^^^^^^^^^^^^^
  2077  
  2078                  err = regmap_bulk_read(priv->map_reg, MCP25XXFD_REG_INT,
  2079                                         &priv->regs_status,
  2080                                         sizeof(priv->regs_status) /
  2081                                         sizeof(u32));
  2082                  if (err)
  2083                          goto out_fail;
  2084  
  2085                  intf_pending = FIELD_GET(MCP25XXFD_REG_INT_IF_MASK,
  2086                                           priv->regs_status.intf) &
  2087                          FIELD_GET(MCP25XXFD_REG_INT_IE_MASK,
  2088                                    priv->regs_status.intf);
  2089  
  2090                  if (!(intf_pending))
  2091                          return handled;
  2092  
  2093                  /* Some interrupts must be ACKed in the
  2094                   * MCP25XXFD_REG_INT register.
  2095                   * - First ACK then handle, to avoid lost-IRQ race
  2096                   *   condition on fast re-occurring interrupts.
  2097                   * - Write "0" to clear active IRQs, "1" to all other,
  2098                   *   to avoid r/m/w race condition on the
  2099                   *   MCP25XXFD_REG_INT register.
  2100                   */
  2101                  intf_pending_clearable = intf_pending &
  2102                          MCP25XXFD_REG_INT_IF_CLEARABLE_MASK;
  2103                  if (intf_pending_clearable) {
  2104                          err = regmap_update_bits(priv->map_reg,
  2105                                                   MCP25XXFD_REG_INT,
  2106                                                   MCP25XXFD_REG_INT_IF_MASK,
  2107                                                   ~intf_pending_clearable);
  2108                          if (err)
  2109                                  goto out_fail;
  2110                  }
  2111  
  2112                  if (intf_pending & MCP25XXFD_REG_INT_MODIF) {
                                           ^^^^^^^^^^^^^^^^^^^^^^^
This is BIT(3)

  2113                          err = mcp25xxfd_handle(priv, modif, &set_normal_mode);
                                                                    ^^^^^^^^^^^^^^^^
  2114                          if (err)
  2115                                  goto out_fail;
  2116                  }
  2117  
  2118                  if (intf_pending & MCP25XXFD_REG_INT_RXIF) {
  2119                          err = mcp25xxfd_handle(priv, rxif);
  2120                          if (err)
  2121                                  goto out_fail;
  2122                  }
  2123  
  2124                  if (intf_pending & MCP25XXFD_REG_INT_TEFIF) {
  2125                          err = mcp25xxfd_handle(priv, tefif);
  2126                          if (err)
  2127                                  goto out_fail;
  2128                  }
  2129  
  2130                  if (intf_pending & MCP25XXFD_REG_INT_RXOVIF) {
  2131                          err = mcp25xxfd_handle(priv, rxovif);
  2132                          if (err)
  2133                                  goto out_fail;
  2134                  }
  2135  
  2136                  if (intf_pending & MCP25XXFD_REG_INT_TXATIF) {
  2137                          err = mcp25xxfd_handle(priv, txatif);
  2138                          if (err)
  2139                                  goto out_fail;
  2140                  }
  2141  
  2142                  if (intf_pending & MCP25XXFD_REG_INT_IVMIF) {
  2143                          err = mcp25xxfd_handle(priv, ivmif);
  2144                          if (err)
  2145                                  goto out_fail;
  2146                  }
  2147  
  2148                  if (intf_pending & MCP25XXFD_REG_INT_SERRIF) {
  2149                          err = mcp25xxfd_handle(priv, serrif);
  2150                          if (err)
  2151                                  goto out_fail;
  2152                  }
  2153  
  2154                  if (intf_pending & MCP25XXFD_REG_INT_ECCIF) {
                                           ^^^^^^^^^^^^^^^^^^^^^^^
This is BIT(8)

  2155                          err = mcp25xxfd_handle(priv, eccif, set_normal_mode);
                                                                    ^^^^^^^^^^^^^^^^
This might not be initialized if BIT(8) is set but BIT(3) is not.

  2156                          if (err)
  2157                                  goto out_fail;

regards,
dan carpenter

             reply	other threads:[~2020-09-23 11:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23 11:29 Dan Carpenter [this message]
2020-09-23 11:43 ` [bug report] can: mcp25xxfd: add driver for Microchip MCP25xxFD SPI CAN Marc Kleine-Budde
  -- strict thread matches above, loose matches on Subject: below --
2020-09-23  9:54 Dan Carpenter
2020-09-23 10:26 ` Marc Kleine-Budde
2020-09-23 10:38   ` 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=20200923112917.GB1473821@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox