aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/qlogic/netxen
diff options
context:
space:
mode:
authorManish Chopra <manish.chopra@qlogic.com>2013-05-30 05:51:35 -0400
committerDavid S. Miller <davem@davemloft.net>2013-05-30 19:52:37 -0400
commitb08a92bb7381ff03d4101bcc61e65120bc690a4f (patch)
treefd3b3d3ea9f2f05f30ff08171565c37d1ff0dacc /drivers/net/ethernet/qlogic/netxen
parentdc7551cbf7744ef7374c3f3c46817413ad4bcc40 (diff)
netxen_nic: Log proper error message in case of mismatched adapter type
o log "Unknown" board name and "Unknown" serial number in case of mismatched adapter type found. This will avoid weird characters logs when an adapter is in bad state or corrupted. Signed-off-by: Manish Chopra <manish.chopra@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/qlogic/netxen')
-rw-r--r--drivers/net/ethernet/qlogic/netxen/netxen_nic.h10
-rw-r--r--drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c4
2 files changed, 10 insertions, 4 deletions
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic.h b/drivers/net/ethernet/qlogic/netxen/netxen_nic.h
index 322a36b76727..e5ab1ecb4bb2 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic.h
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic.h
@@ -1855,7 +1855,7 @@ static const struct netxen_brdinfo netxen_boards[] = {
1855 1855
1856#define NUM_SUPPORTED_BOARDS ARRAY_SIZE(netxen_boards) 1856#define NUM_SUPPORTED_BOARDS ARRAY_SIZE(netxen_boards)
1857 1857
1858static inline void get_brd_name_by_type(u32 type, char *name) 1858static inline int netxen_nic_get_brd_name_by_type(u32 type, char *name)
1859{ 1859{
1860 int i, found = 0; 1860 int i, found = 0;
1861 for (i = 0; i < NUM_SUPPORTED_BOARDS; ++i) { 1861 for (i = 0; i < NUM_SUPPORTED_BOARDS; ++i) {
@@ -1864,10 +1864,14 @@ static inline void get_brd_name_by_type(u32 type, char *name)
1864 found = 1; 1864 found = 1;
1865 break; 1865 break;
1866 } 1866 }
1867 }
1867 1868
1869 if (!found) {
1870 strcpy(name, "Unknown");
1871 return -EINVAL;
1868 } 1872 }
1869 if (!found) 1873
1870 name = "Unknown"; 1874 return 0;
1871} 1875}
1872 1876
1873static inline u32 netxen_tx_avail(struct nx_host_tx_ring *tx_ring) 1877static inline u32 netxen_tx_avail(struct nx_host_tx_ring *tx_ring)
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index 2294cd2293b1..558df468f2e4 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -841,7 +841,9 @@ netxen_check_options(struct netxen_adapter *adapter)
841 } 841 }
842 842
843 if (adapter->portnum == 0) { 843 if (adapter->portnum == 0) {
844 get_brd_name_by_type(adapter->ahw.board_type, brd_name); 844 if (netxen_nic_get_brd_name_by_type(adapter->ahw.board_type,
845 brd_name))
846 strcpy(serial_num, "Unknown");
845 847
846 pr_info("%s: %s Board S/N %s Chip rev 0x%x\n", 848 pr_info("%s: %s Board S/N %s Chip rev 0x%x\n",
847 module_name(THIS_MODULE), 849 module_name(THIS_MODULE),