RE: [PATCH net-next 2/3] Add LAN743X to Kconfig and Makefile (fwd)

2017-08-14 Thread Bryan.Whitehead
> I don't think netdev_priv can return NULL, so lines 6641 to 6646 could just be
> dropped.
> 
> julia
> 

Julia,

Thanks for the feedback.
I will make changes and submit again later.

Bryan


Re: [PATCH net-next 2/3] Add LAN743X to Kconfig and Makefile

2017-08-14 Thread kbuild test robot
Hi Bryan,

[auto build test WARNING on net-next/master]

url:
https://github.com/0day-ci/linux/commits/Bryan-Whitehead-microchip-com/Add-LAN743X-driver/20170814-141247
config: i386-allyesconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/net//ethernet/microchip/lan743x.c: In function 
'lan743x_ptpci_settime64':
>> drivers/net//ethernet/microchip/lan743x.c:1117:83: warning: format '%ld' 
>> expects argument of type 'long int', but argument 4 has type 'time64_t {aka 
>> const long long int}' [-Wformat=]
   NETIF_WARNING(adapter, drv, adapter->netdev,

  ^ 

vim +1117 drivers/net//ethernet/microchip/lan743x.c

a33f5600 Bryan Whitehead 2017-08-11  1103  
a33f5600 Bryan Whitehead 2017-08-11  1104  #ifdef CONFIG_PTP_1588_CLOCK
a33f5600 Bryan Whitehead 2017-08-11  1105  static int 
lan743x_ptpci_settime64(struct ptp_clock_info *ptpci,
a33f5600 Bryan Whitehead 2017-08-11  1106  
const struct timespec64 *ts)
a33f5600 Bryan Whitehead 2017-08-11  1107  {
a33f5600 Bryan Whitehead 2017-08-11  1108   struct lan743x_ptp *ptp = 
LAN743X_PTPCI_TO_PTP;
a33f5600 Bryan Whitehead 2017-08-11  1109   struct lan743x_adapter *adapter 
= LAN743X_PTP_TO_ADAPTER;
a33f5600 Bryan Whitehead 2017-08-11  1110  
a33f5600 Bryan Whitehead 2017-08-11     if (ts) {
a33f5600 Bryan Whitehead 2017-08-11  1112   u32 seconds = 0;
a33f5600 Bryan Whitehead 2017-08-11  1113   u32 nano_seconds = 0;
a33f5600 Bryan Whitehead 2017-08-11  1114  
a33f5600 Bryan Whitehead 2017-08-11  1115   if ((ts->tv_sec > 
0xLL) ||
a33f5600 Bryan Whitehead 2017-08-11  1116   (ts->tv_sec < 0)) {
a33f5600 Bryan Whitehead 2017-08-11 @1117   
NETIF_WARNING(adapter, drv, adapter->netdev,
a33f5600 Bryan Whitehead 2017-08-11  1118 
"ts->tv_sec out of range, %ld",
a33f5600 Bryan Whitehead 2017-08-11  1119 
ts->tv_sec);
a33f5600 Bryan Whitehead 2017-08-11  1120   return -EINVAL;
a33f5600 Bryan Whitehead 2017-08-11  1121   }
a33f5600 Bryan Whitehead 2017-08-11  1122   if ((ts->tv_nsec >= 
10L) ||
a33f5600 Bryan Whitehead 2017-08-11  1123   (ts->tv_nsec < 0)) {
a33f5600 Bryan Whitehead 2017-08-11  1124   
NETIF_WARNING(adapter, drv, adapter->netdev,
a33f5600 Bryan Whitehead 2017-08-11  1125 
"ts->tv_nsec out of range, %ld",
a33f5600 Bryan Whitehead 2017-08-11  1126 
ts->tv_nsec);
a33f5600 Bryan Whitehead 2017-08-11  1127   return -EINVAL;
a33f5600 Bryan Whitehead 2017-08-11  1128   }
a33f5600 Bryan Whitehead 2017-08-11  1129   seconds = ts->tv_sec;
a33f5600 Bryan Whitehead 2017-08-11  1130   nano_seconds = 
ts->tv_nsec;
a33f5600 Bryan Whitehead 2017-08-11  1131   NETIF_INFO(adapter, 
drv, adapter->netdev,
a33f5600 Bryan Whitehead 2017-08-11  1132  "settime = 
%u.%09u", seconds, nano_seconds);
a33f5600 Bryan Whitehead 2017-08-11  1133   
lan743x_ptp_clock_set(adapter, seconds, nano_seconds, 0);
a33f5600 Bryan Whitehead 2017-08-11  1134   } else {
a33f5600 Bryan Whitehead 2017-08-11  1135   NETIF_WARNING(adapter, 
drv, adapter->netdev, "ts == NULL");
a33f5600 Bryan Whitehead 2017-08-11  1136   return -EINVAL;
a33f5600 Bryan Whitehead 2017-08-11  1137   }
a33f5600 Bryan Whitehead 2017-08-11  1138   return 0;
a33f5600 Bryan Whitehead 2017-08-11  1139  }
a33f5600 Bryan Whitehead 2017-08-11  1140  #endif /*CONFIG_PTP_1588_CLOCK */
a33f5600 Bryan Whitehead 2017-08-11  1141  

:: The code at line 1117 was first introduced by commit
:: a33f5600a21257dc396a7278c7c5ff74ac2f7844 Add LAN743X driver

:: TO: Bryan Whitehead 
:: CC: 0day robot 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH net-next 2/3] Add LAN743X to Kconfig and Makefile (fwd)

2017-08-14 Thread Julia Lawall
I don't think netdev_priv can return NULL, so lines 6641 to 6646 could
just be dropped.

julia

-- Forwarded message --
Date: Mon, 14 Aug 2017 18:14:12 +0800
From: kbuild test robot <fengguang...@intel.com>
To: kbu...@01.org
Cc: Julia Lawall <julia.law...@lip6.fr>
Subject: Re: [PATCH net-next 2/3] Add LAN743X to Kconfig and Makefile

CC: kbuild-...@01.org
In-Reply-To: 
<90a7e81ae28bae4cbddb3b35f187d264406f6...@chn-sv-exmx02.mchp-main.com>
TO: bryan.whiteh...@microchip.com
CC: netdev@vger.kernel.org, da...@davemloft.net
CC: unglinuxdri...@microchip.com

Hi Bryan,

[auto build test WARNING on net-next/master]

url:
https://github.com/0day-ci/linux/commits/Bryan-Whitehead-microchip-com/Add-LAN743X-driver/20170814-141247
:: branch date: 4 hours ago
:: commit date: 4 hours ago

>> drivers/net/ethernet/microchip/lan743x.c:6642:39-45: ERROR: adapter is NULL 
>> but dereferenced.

# 
https://github.com/0day-ci/linux/commit/dabee19fb26fee5184b2b304b12080be0f78a3f2
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout dabee19fb26fee5184b2b304b12080be0f78a3f2
vim +6642 drivers/net/ethernet/microchip/lan743x.c

a33f5600 Bryan Whitehead 2017-08-11  6609
a33f5600 Bryan Whitehead 2017-08-11  6610  /* lan743x_pcidev_probe - Device 
Initialization Routine
a33f5600 Bryan Whitehead 2017-08-11  6611   * @pdev: PCI device information 
struct
a33f5600 Bryan Whitehead 2017-08-11  6612   * @id: entry in lan743x_pci_tbl
a33f5600 Bryan Whitehead 2017-08-11  6613   *
a33f5600 Bryan Whitehead 2017-08-11  6614   * Returns 0 on success, negative on 
failure
a33f5600 Bryan Whitehead 2017-08-11  6615   *
a33f5600 Bryan Whitehead 2017-08-11  6616   * initializes an adapter identified 
by a pci_dev structure.
a33f5600 Bryan Whitehead 2017-08-11  6617   * The OS initialization, 
configuring of the adapter private structure,
a33f5600 Bryan Whitehead 2017-08-11  6618   * and a hardware reset occur.
a33f5600 Bryan Whitehead 2017-08-11  6619   **/
a33f5600 Bryan Whitehead 2017-08-11  6620  static int 
lan743x_pcidev_probe(struct pci_dev *pdev,
a33f5600 Bryan Whitehead 2017-08-11  6621   const 
struct pci_device_id *id)
a33f5600 Bryan Whitehead 2017-08-11  6622  {
a33f5600 Bryan Whitehead 2017-08-11  6623   struct net_device *netdev = 
NULL;
a33f5600 Bryan Whitehead 2017-08-11  6624   struct lan743x_adapter *adapter 
= NULL;
a33f5600 Bryan Whitehead 2017-08-11  6625   int ret = -ENODEV;
a33f5600 Bryan Whitehead 2017-08-11  6626
a33f5600 Bryan Whitehead 2017-08-11  6627   NETIF_ASSERT(adapter, probe, 
adapter->netdev, pdev);
a33f5600 Bryan Whitehead 2017-08-11  6628
a33f5600 Bryan Whitehead 2017-08-11  6629   netdev = 
alloc_etherdev(sizeof(struct lan743x_adapter));
a33f5600 Bryan Whitehead 2017-08-11  6630   if (!netdev) {
a33f5600 Bryan Whitehead 2017-08-11  6631   NETIF_ERROR(adapter, 
probe, adapter->netdev,
a33f5600 Bryan Whitehead 2017-08-11  6632   
"alloc_etherdev returned NULL");
a33f5600 Bryan Whitehead 2017-08-11  6633   ret = -ENOMEM;
a33f5600 Bryan Whitehead 2017-08-11  6634   goto clean_up;
a33f5600 Bryan Whitehead 2017-08-11  6635   }
a33f5600 Bryan Whitehead 2017-08-11  6636
a33f5600 Bryan Whitehead 2017-08-11  6637   strncpy(netdev->name, 
pci_name(pdev), sizeof(netdev->name) - 1);
a33f5600 Bryan Whitehead 2017-08-11  6638   SET_NETDEV_DEV(netdev, 
>dev);
a33f5600 Bryan Whitehead 2017-08-11  6639   pci_set_drvdata(pdev, netdev);
a33f5600 Bryan Whitehead 2017-08-11  6640   adapter = netdev_priv(netdev);
a33f5600 Bryan Whitehead 2017-08-11  6641   if (!adapter) {
a33f5600 Bryan Whitehead 2017-08-11 @6642   NETIF_ERROR(adapter, 
probe, adapter->netdev,
a33f5600 Bryan Whitehead 2017-08-11  6643   
"netdev_priv returned NULL");
a33f5600 Bryan Whitehead 2017-08-11  6644   ret = -ENOMEM;
a33f5600 Bryan Whitehead 2017-08-11  6645   goto clean_up;
a33f5600 Bryan Whitehead 2017-08-11  6646   }
a33f5600 Bryan Whitehead 2017-08-11  6647   memset(adapter, 0, 
sizeof(struct lan743x_adapter));
a33f5600 Bryan Whitehead 2017-08-11  6648   adapter->netdev = netdev;
a33f5600 Bryan Whitehead 2017-08-11  6649   adapter->init_flags = 0;
a33f5600 Bryan Whitehead 2017-08-11  6650   adapter->open_flags = 0;
a33f5600 Bryan Whitehead 2017-08-11  6651   adapter->msg_enable = 
msg_enable;
a33f5600 Bryan Whitehead 2017-08-11  6652   netdev->max_mtu = 
LAN743X_MAX_FRAME_SIZE;
a33f5600 Bryan Whitehead 2017-08-11  6653
a33f5600 Bryan Whitehead 2017-08-11  6654   ret = lan743x_pci_init(adapter, 
pdev);
a33f5600 Bryan Whitehead 2017-08-11  6655   if (ret) {
a33f5600 Bryan Whitehead 2017-08-11  6656   NETIF_ERROR(adapter, 
probe, adapter->netdev,
a33f5600 Bry

[PATCH net-next 2/3] Add LAN743X to Kconfig and Makefile

2017-08-11 Thread Bryan.Whitehead
From: Bryan Whitehead 

Add LAN743X Driver to Kconfig and Makefile

Removed "depends on SPI" from NET_VENDOR_MICROCHIP group
Because all existing drivers already specify SPI dependency, and
New driver does not have SPI dependency.

Signed-off-by: Bryan Whitehead 
---
 drivers/net/ethernet/microchip/Kconfig  | 10 +-
 drivers/net/ethernet/microchip/Makefile |  1 +
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/microchip/Kconfig 
b/drivers/net/ethernet/microchip/Kconfig
index 36a09d9..5796718 100644
--- a/drivers/net/ethernet/microchip/Kconfig
+++ b/drivers/net/ethernet/microchip/Kconfig
@@ -5,7 +5,6 @@
 config NET_VENDOR_MICROCHIP
bool "Microchip devices"
default y
-   depends on SPI
---help---
  If you have a network (Ethernet) card belonging to this class, say Y.
 
@@ -42,4 +41,13 @@ config ENCX24J600
   To compile this driver as a module, choose M here. The module will be
   called encx24j600.
 
+config LAN743X
+   tristate "LAN7430 support"
+   depends on PCI
+   ---help---
+ Support for the Microchip LAN7430 PCI Express Gigabit Ethernet chip
+
+ To compile this driver as a module, choose M here. The module will be
+ called lan743x.
+
 endif # NET_VENDOR_MICROCHIP
diff --git a/drivers/net/ethernet/microchip/Makefile 
b/drivers/net/ethernet/microchip/Makefile
index ff78f62..f7215dd 100644
--- a/drivers/net/ethernet/microchip/Makefile
+++ b/drivers/net/ethernet/microchip/Makefile
@@ -4,3 +4,4 @@
 
 obj-$(CONFIG_ENC28J60) += enc28j60.o
 obj-$(CONFIG_ENCX24J600) += encx24j600.o encx24j600-regmap.o
+obj-$(CONFIG_LAN743X) += lan743x.o
-- 
2.7.4