Skip to contentSkip to conversation

net: Microchip encx24j600 driver

PATCH Applied [email protected] 2 participants 2 messages Oct 6, 2015 – Oct 8, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 net: Microchip encx24j600 driver

From: Jon Ringle <[email protected]>

This ethernet driver supports the Micorchip enc424j600/626j600 Ethernet controller over a SPI bus interface. This driver makes use of the regmap API to optimize access to registers by caching registers where possible.

Datasheet:
http://ww1.microchip.com/downloads/en/DeviceDoc/39935b.pdf

---

This patch requires that the pull request from Mark be applied first:
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git tags/regmap-offload-update-bits

Since the v3 patch, this v4 patch addesses the issue brought up by:

Quoted 23 lines

Hello Jon Ringle,

This is a semi-automatic email about new static checker warnings.

The patch 04fbfce7a222: "net: Microchip encx24j600 driver" from Oct 1, 2015, leads to the following Smatch complaint:

drivers/net/ethernet/microchip/encx24j600.c:313 encx24j600_tx_complete()

	 warn: variable dereferenced before check 'priv->tx_skb' (see line 307)

drivers/net/ethernet/microchip/encx24j600.c
306

   307		dev->stats.tx_bytes += priv->tx_skb->len;
                                       ^^^^^^^^^^^^

Unchecked dereference.

   308	
   309		encx24j600_clr_bits(priv, EIR, TXIF | TXABTIF);
   310	
   311		netif_dbg(priv, tx_done, dev, "TX Done%s\n", err ? ": Err" : "");
   312	
   313		if (priv->tx_skb) {
                    ^^^^^^^^^^^^
Quoted 7 lines

Too late.

   314			dev_kfree_skb(priv->tx_skb);
   315			priv->tx_skb = NULL;

regards,
dan carpenter

Thank you,

Jon

 drivers/net/ethernet/microchip/Kconfig             |    9 +
 drivers/net/ethernet/microchip/Makefile            |    1 +
 drivers/net/ethernet/microchip/encx24j600-regmap.c |  513 +++++++++
 drivers/net/ethernet/microchip/encx24j600.c        | 1127 ++++++++++++++++++++
 drivers/net/ethernet/microchip/encx24j600_hw.h     |  437 ++++++++
 5 files changed, 2087 insertions(+)
 create mode 100644 drivers/net/ethernet/microchip/encx24j600-regmap.c
 create mode 100644 drivers/net/ethernet/microchip/encx24j600.c
 create mode 100644 drivers/net/ethernet/microchip/encx24j600_hw.h
drivers/net/ethernet/microchip/Kconfig +9 -0
index afaf0c0..b45b28a 100644
@@ -35,4 +35,13 @@ config ENC28J60_WRITEVERIFY
 	  Enable the verify after the buffer write useful for debugging purpose.
 	  If unsure, say N.
 
+config ENCX24J600
+    tristate "ENCX24J600 support"
+    depends on SPI
+    ---help---
+      Support for the Microchip ENC424J600 ethernet chip.
+
+      To compile this driver as a module, choose M here. The module will be
+      called enc424j600.
+
 endif # NET_VENDOR_MICROCHIP
drivers/net/ethernet/microchip/Makefile +1 -0
index 573d429..ff78f62 100644
@@ -3,3 +3,4 @@
 #
 
 obj-$(CONFIG_ENC28J60) += enc28j60.o
+obj-$(CONFIG_ENCX24J600) += encx24j600.o encx24j600-regmap.o
drivers/net/ethernet/microchip/encx24j600-regmap.c new file +513 -0

513 lines not on this page · raw message

drivers/net/ethernet/microchip/encx24j600.c new file +1127 -0

1,127 lines not on this page · raw message

drivers/net/ethernet/microchip/encx24j600_hw.h new file +437 -0

437 lines not on this page · raw message

Signature · 1 line
2.4.1
maintainer Applied
#1 lore raw

From: [email protected]
Date: Tue, 6 Oct 2015 16:37:46 -0400

Quoted 6 lines

From: Jon Ringle <[email protected]>

This ethernet driver supports the Micorchip enc424j600/626j600 Ethernet controller over a SPI bus interface. This driver makes use of the regmap API to optimize access to registers by caching registers where possible.

Quoted 8 lines

Datasheet:
http://ww1.microchip.com/downloads/en/DeviceDoc/39935b.pdf

---

This patch requires that the pull request from Mark be applied first:
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git tags/regmap-offload-update-bits

Applied, thanks Jon.