浏览代码

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>
Lendacky, Thomas 9 年之前
父节点
当前提交
1c1f619e45
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      drivers/net/ethernet/amd/xgbe/xgbe-dev.c

+ 2 - 2
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);