Skip to content

Commit

Permalink
bna: fix error handling
Browse files Browse the repository at this point in the history
Several functions can return negative value in case of error,
so their return type should be fixed as well as type of variables
to which this value is assigned.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Andrzej Hajda authored and David S. Miller committed Sep 29, 2015
1 parent 3504bb6 commit 4c52b1d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions drivers/net/ethernet/brocade/bna/bfa_ioc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1543,7 +1543,7 @@ bfa_flash_cmd_act_check(void __iomem *pci_bar)
}

/* Flush FLI data fifo. */
static u32
static int
bfa_flash_fifo_flush(void __iomem *pci_bar)
{
u32 i;
Expand Down Expand Up @@ -1573,11 +1573,11 @@ bfa_flash_fifo_flush(void __iomem *pci_bar)
}

/* Read flash status. */
static u32
static int
bfa_flash_status_read(void __iomem *pci_bar)
{
union bfa_flash_dev_status_reg dev_status;
u32 status;
int status;
u32 ret_status;
int i;

Expand Down Expand Up @@ -1611,11 +1611,11 @@ bfa_flash_status_read(void __iomem *pci_bar)
}

/* Start flash read operation. */
static u32
static int
bfa_flash_read_start(void __iomem *pci_bar, u32 offset, u32 len,
char *buf)
{
u32 status;
int status;

/* len must be mutiple of 4 and not exceeding fifo size */
if (len == 0 || len > BFA_FLASH_FIFO_SIZE || (len & 0x03) != 0)
Expand Down Expand Up @@ -1703,7 +1703,8 @@ static enum bfa_status
bfa_flash_raw_read(void __iomem *pci_bar, u32 offset, char *buf,
u32 len)
{
u32 n, status;
u32 n;
int status;
u32 off, l, s, residue, fifo_sz;

residue = len;
Expand Down

0 comments on commit 4c52b1d

Please sign in to comment.