瀏覽代碼

gpio: syscon: Fix possible NULL ptr usage

The priv->data->set can be NULL while flags contains GPIO_SYSCON_FEAT_OUT
and chip->set is valid pointer. This happens in case the controller uses
the default GPIO setter. Always use chip->set to access the setter to avoid
possible NULL pointer dereferencing.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Marek Vasut 6 年之前
父節點
當前提交
70728c2946
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/gpio/gpio-syscon.c

+ 1 - 1
drivers/gpio/gpio-syscon.c

@@ -122,7 +122,7 @@ static int syscon_gpio_dir_out(struct gpio_chip *chip, unsigned offset, int val)
 				   BIT(offs % SYSCON_REG_BITS));
 	}
 
-	priv->data->set(chip, offset, val);
+	chip->set(chip, offset, val);
 
 	return 0;
 }