瀏覽代碼

tegra: gpio: fix null label regression

Fix Tegra GPIO driver to not crash resp. misbehave upon requesting
GPIOs with an empty aka NULL label. As the driver uses exclusively the
label to check for reservation status actually supplying one is
mandatory!

This fixes a regression introduced by commit:

2fccd2d96badcdf6165658a99771a4c475586279
tegra: Convert tegra GPIO driver to use driver model

Signed-off-by: Marcel Ziswiler <marcel@ziswiler.com>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
Marcel Ziswiler 10 年之前
父節點
當前提交
1c1786d4c5
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      drivers/gpio/tegra_gpio.c

+ 3 - 0
drivers/gpio/tegra_gpio.c

@@ -171,6 +171,9 @@ static int tegra_gpio_request(struct udevice *dev, unsigned offset,
 {
 	struct tegra_port_info *state = dev_get_priv(dev);
 
+	if (!label)
+		return -EINVAL;
+
 	if (*state->label[offset])
 		return -EBUSY;