summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/amd
diff options
context:
space:
mode:
authorLendacky, Thomas2016-11-15 23:11:15 +0100
committerDavid S. Miller2016-11-16 19:57:44 +0100
commit1c1f619e451bdbf29c3be9ed11c77d488b56dfd9 (patch)
tree05373315f75629a5eb73e1601f1a8b4020aa6aa6 /drivers/net/ethernet/amd
parentamd-xgbe: Fix possible uninitialized variable (diff)
downloadkernel-qcow2-linux-1c1f619e451bdbf29c3be9ed11c77d488b56dfd9.tar.gz
kernel-qcow2-linux-1c1f619e451bdbf29c3be9ed11c77d488b56dfd9.tar.xz
kernel-qcow2-linux-1c1f619e451bdbf29c3be9ed11c77d488b56dfd9.zip
amd-xgbe: Fix maximum GPIO value check
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>
Diffstat (limited to 'drivers/net/ethernet/amd')
-rw-r--r--drivers/net/ethernet/amd/xgbe/xgbe-dev.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
index 30056e24e1fc..aaf0350076a9 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
@@ -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);
@@ -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);