Skip to content

Commit

Permalink
amd-xgbe: Fix maximum GPIO value check
Browse files Browse the repository at this point in the history
The GPIO support in the hardware allows for up to 16 GPIO pins, enumerated
from 0 to 15.  The driver uses the wrong value (16) to validate the GPIO
pin range in the routines to set and clear the GPIO output pins.  Update
the code to use the correct value (15).

Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Lendacky, Thomas authored and David S. Miller committed Nov 16, 2016
1 parent 5e4cbaa commit 1c1f619
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/amd/xgbe/xgbe-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ static int xgbe_clr_gpio(struct xgbe_prv_data *pdata, unsigned int gpio)
{
unsigned int reg;

if (gpio > 16)
if (gpio > 15)
return -EINVAL;

reg = XGMAC_IOREAD(pdata, MAC_GPIOSR);
Expand All @@ -1114,7 +1114,7 @@ static int xgbe_set_gpio(struct xgbe_prv_data *pdata, unsigned int gpio)
{
unsigned int reg;

if (gpio > 16)
if (gpio > 15)
return -EINVAL;

reg = XGMAC_IOREAD(pdata, MAC_GPIOSR);
Expand Down

0 comments on commit 1c1f619

Please sign in to comment.