]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Feb 2022 09:13:25 +0000 (10:13 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Feb 2022 09:13:25 +0000 (10:13 +0100)
added patches:
gpio-tegra186-fix-chip_data-type-confusion.patch

queue-5.4/gpio-tegra186-fix-chip_data-type-confusion.patch [new file with mode: 0644]
queue-5.4/series

diff --git a/queue-5.4/gpio-tegra186-fix-chip_data-type-confusion.patch b/queue-5.4/gpio-tegra186-fix-chip_data-type-confusion.patch
new file mode 100644 (file)
index 0000000..45a0f1d
--- /dev/null
@@ -0,0 +1,80 @@
+From d1e972ace42390de739cde87d96043dcbe502286 Mon Sep 17 00:00:00 2001
+From: Marc Zyngier <maz@kernel.org>
+Date: Fri, 11 Feb 2022 09:39:04 +0000
+Subject: gpio: tegra186: Fix chip_data type confusion
+
+From: Marc Zyngier <maz@kernel.org>
+
+commit d1e972ace42390de739cde87d96043dcbe502286 upstream.
+
+The tegra186 GPIO driver makes the assumption that the pointer
+returned by irq_data_get_irq_chip_data() is a pointer to a
+tegra_gpio structure. Unfortunately, it is actually a pointer
+to the inner gpio_chip structure, as mandated by the gpiolib
+infrastructure. Nice try.
+
+The saving grace is that the gpio_chip is the first member of
+tegra_gpio, so the bug has gone undetected since... forever.
+
+Fix it by performing a container_of() on the pointer. This results
+in no additional code, and makes it possible to understand how
+the whole thing works.
+
+Fixes: 5b2b135a87fc ("gpio: Add Tegra186 support")
+Signed-off-by: Marc Zyngier <maz@kernel.org>
+Cc: Thierry Reding <treding@nvidia.com>
+Cc: Linus Walleij <linus.walleij@linaro.org>
+Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
+Link: https://lore.kernel.org/r/20220211093904.1112679-1-maz@kernel.org
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpio/gpio-tegra186.c |   14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+--- a/drivers/gpio/gpio-tegra186.c
++++ b/drivers/gpio/gpio-tegra186.c
+@@ -234,9 +234,12 @@ static int tegra186_gpio_of_xlate(struct
+       return offset + pin;
+ }
++#define to_tegra_gpio(x) container_of((x), struct tegra_gpio, gpio)
++
+ static void tegra186_irq_ack(struct irq_data *data)
+ {
+-      struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data);
++      struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
++      struct tegra_gpio *gpio = to_tegra_gpio(gc);
+       void __iomem *base;
+       base = tegra186_gpio_get_base(gpio, data->hwirq);
+@@ -248,7 +251,8 @@ static void tegra186_irq_ack(struct irq_
+ static void tegra186_irq_mask(struct irq_data *data)
+ {
+-      struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data);
++      struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
++      struct tegra_gpio *gpio = to_tegra_gpio(gc);
+       void __iomem *base;
+       u32 value;
+@@ -263,7 +267,8 @@ static void tegra186_irq_mask(struct irq
+ static void tegra186_irq_unmask(struct irq_data *data)
+ {
+-      struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data);
++      struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
++      struct tegra_gpio *gpio = to_tegra_gpio(gc);
+       void __iomem *base;
+       u32 value;
+@@ -278,7 +283,8 @@ static void tegra186_irq_unmask(struct i
+ static int tegra186_irq_set_type(struct irq_data *data, unsigned int type)
+ {
+-      struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data);
++      struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
++      struct tegra_gpio *gpio = to_tegra_gpio(gc);
+       void __iomem *base;
+       u32 value;
index fd3ad96c085f40a6e224674afd72126b677aa0b0..0b8deed2c46d79f04b2912a24c15e452b72c3709 100644 (file)
@@ -47,3 +47,4 @@ xhci-prevent-futile-urb-re-submissions-due-to-incorrect-return-value.patch
 tty-n_gsm-fix-encoding-of-control-signal-octet-bit-dv.patch
 tty-n_gsm-fix-proper-link-termination-after-failed-open.patch
 tty-n_gsm-fix-null-pointer-access-due-to-dlci-release.patch
+gpio-tegra186-fix-chip_data-type-confusion.patch