Commit 027a3b61 authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

bna: fix error handling of bnad_get_flash_partition_by_offset()

The current error handling doesn't work because we flash_part is a u32
so the checks for negative error codes don't work.  I considered making
things signed but I don't know the hardware enough to say if that's a
problem.  Really, we don't use the error codes so just returning zero
for all problems is fine.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5a46e0f9
...@@ -946,7 +946,7 @@ bnad_get_flash_partition_by_offset(struct bnad *bnad, u32 offset, ...@@ -946,7 +946,7 @@ bnad_get_flash_partition_by_offset(struct bnad *bnad, u32 offset,
flash_attr = kzalloc(sizeof(struct bfa_flash_attr), GFP_KERNEL); flash_attr = kzalloc(sizeof(struct bfa_flash_attr), GFP_KERNEL);
if (!flash_attr) if (!flash_attr)
return -ENOMEM; return 0;
fcomp.bnad = bnad; fcomp.bnad = bnad;
fcomp.comp_status = 0; fcomp.comp_status = 0;
...@@ -958,7 +958,7 @@ bnad_get_flash_partition_by_offset(struct bnad *bnad, u32 offset, ...@@ -958,7 +958,7 @@ bnad_get_flash_partition_by_offset(struct bnad *bnad, u32 offset,
if (ret != BFA_STATUS_OK) { if (ret != BFA_STATUS_OK) {
spin_unlock_irqrestore(&bnad->bna_lock, flags); spin_unlock_irqrestore(&bnad->bna_lock, flags);
kfree(flash_attr); kfree(flash_attr);
goto out_err; return 0;
} }
spin_unlock_irqrestore(&bnad->bna_lock, flags); spin_unlock_irqrestore(&bnad->bna_lock, flags);
wait_for_completion(&fcomp.comp); wait_for_completion(&fcomp.comp);
...@@ -978,8 +978,6 @@ bnad_get_flash_partition_by_offset(struct bnad *bnad, u32 offset, ...@@ -978,8 +978,6 @@ bnad_get_flash_partition_by_offset(struct bnad *bnad, u32 offset,
} }
kfree(flash_attr); kfree(flash_attr);
return flash_part; return flash_part;
out_err:
return -EINVAL;
} }
static int static int
...@@ -1006,7 +1004,7 @@ bnad_get_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom, ...@@ -1006,7 +1004,7 @@ bnad_get_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
/* Query the flash partition based on the offset */ /* Query the flash partition based on the offset */
flash_part = bnad_get_flash_partition_by_offset(bnad, flash_part = bnad_get_flash_partition_by_offset(bnad,
eeprom->offset, &base_offset); eeprom->offset, &base_offset);
if (flash_part <= 0) if (flash_part == 0)
return -EFAULT; return -EFAULT;
fcomp.bnad = bnad; fcomp.bnad = bnad;
...@@ -1048,7 +1046,7 @@ bnad_set_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom, ...@@ -1048,7 +1046,7 @@ bnad_set_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
/* Query the flash partition based on the offset */ /* Query the flash partition based on the offset */
flash_part = bnad_get_flash_partition_by_offset(bnad, flash_part = bnad_get_flash_partition_by_offset(bnad,
eeprom->offset, &base_offset); eeprom->offset, &base_offset);
if (flash_part <= 0) if (flash_part == 0)
return -EFAULT; return -EFAULT;
fcomp.bnad = bnad; fcomp.bnad = bnad;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment