Skip to content

Commit

Permalink
cxgb4: Fix t4_flash_erase_sectors() to throw an error when requested …
Browse files Browse the repository at this point in the history
…to erase sectors which aren't in the FLASH

Based on original work by Casey Leedom <leedom@chelsio.com>

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Hariprasad Shenai authored and David S. Miller committed Sep 10, 2014
1 parent fe2ee13 commit c0d5b8c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,9 @@ static int t4_flash_erase_sectors(struct adapter *adapter, int start, int end)
{
int ret = 0;

if (end >= adapter->params.sf_nsec)
return -EINVAL;

while (start <= end) {
if ((ret = sf1_write(adapter, 1, 0, 1, SF_WR_ENABLE)) != 0 ||
(ret = sf1_write(adapter, 4, 0, 1,
Expand Down

0 comments on commit c0d5b8c

Please sign in to comment.