be2net: make be_cmd_get_regs() return a status
authorVasundhara Volam <vasundhara.volam@emulex.com>
Tue, 2 Sep 2014 04:26:54 +0000 (09:56 +0530)
committerDavid S. Miller <davem@davemloft.net>
Tue, 2 Sep 2014 19:46:00 +0000 (12:46 -0700)
There are a few failure cases in be_cmd_get_regs() that ideally must return
an error value. This style is used across all the routines in be_cmds.c with
this routine being an exception. This patch fixes this.

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/emulex/benet/be_cmds.c
drivers/net/ethernet/emulex/benet/be_cmds.h

index ca9ec18..5be100d 100644 (file)
@@ -1681,17 +1681,17 @@ err:
        return status;
 }
 
-void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf)
+int be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf)
 {
        struct be_dma_mem get_fat_cmd;
        struct be_mcc_wrb *wrb;
        struct be_cmd_req_get_fat *req;
        u32 offset = 0, total_size, buf_size,
                                log_offset = sizeof(u32), payload_len;
-       int status;
+       int status = 0;
 
        if (buf_len == 0)
-               return;
+               return -EIO;
 
        total_size = buf_len;
 
@@ -1700,10 +1700,9 @@ void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf)
                                              get_fat_cmd.size,
                                              &get_fat_cmd.dma);
        if (!get_fat_cmd.va) {
-               status = -ENOMEM;
                dev_err(&adapter->pdev->dev,
                "Memory allocation failure while retrieving FAT data\n");
-               return;
+               return -ENOMEM;
        }
 
        spin_lock_bh(&adapter->mcc_lock);
@@ -1746,6 +1745,7 @@ err:
        pci_free_consistent(adapter->pdev, get_fat_cmd.size,
                            get_fat_cmd.va, get_fat_cmd.dma);
        spin_unlock_bh(&adapter->mcc_lock);
+       return status;
 }
 
 /* Uses synchronous mcc */
index 5284b82..0e11868 100644 (file)
@@ -2101,7 +2101,7 @@ int be_cmd_get_die_temperature(struct be_adapter *adapter);
 int be_cmd_get_cntl_attributes(struct be_adapter *adapter);
 int be_cmd_req_native_mode(struct be_adapter *adapter);
 int be_cmd_get_reg_len(struct be_adapter *adapter, u32 *log_size);
-void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf);
+int be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf);
 int be_cmd_get_fn_privileges(struct be_adapter *adapter, u32 *privilege,
                             u32 domain);
 int be_cmd_set_fn_privileges(struct be_adapter *adapter, u32 privileges,