diff options
| author | Hariprasad Shenai <hariprasad@chelsio.com> | 2014-09-10 08:14:29 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2014-09-10 17:01:54 -0400 |
| commit | c0d5b8cf50c9842d0efcfb14871e58f42c6576e6 (patch) | |
| tree | c0310b6f380bde6b9355d08657a3a5bccabba138 | |
| parent | fe2ee139aa295936e2bf6b7c620624d871c65058 (diff) | |
cxgb4: Fix t4_flash_erase_sectors() to throw an error when requested 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>
| -rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index 7d4cc28ca365..586a5f1fba0f 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
| @@ -1099,6 +1099,9 @@ static int t4_flash_erase_sectors(struct adapter *adapter, int start, int end) | |||
| 1099 | { | 1099 | { |
| 1100 | int ret = 0; | 1100 | int ret = 0; |
| 1101 | 1101 | ||
| 1102 | if (end >= adapter->params.sf_nsec) | ||
| 1103 | return -EINVAL; | ||
| 1104 | |||
| 1102 | while (start <= end) { | 1105 | while (start <= end) { |
| 1103 | if ((ret = sf1_write(adapter, 1, 0, 1, SF_WR_ENABLE)) != 0 || | 1106 | if ((ret = sf1_write(adapter, 1, 0, 1, SF_WR_ENABLE)) != 0 || |
| 1104 | (ret = sf1_write(adapter, 4, 0, 1, | 1107 | (ret = sf1_write(adapter, 4, 0, 1, |
