]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.51/mailbox-stm32-ipcc-check-invalid-irq.patch
Linux 5.1.10
[thirdparty/kernel/stable-queue.git] / releases / 4.19.51 / mailbox-stm32-ipcc-check-invalid-irq.patch
1 From 3523cdbc64dcd41053bbf0ec1be1b431b81e0f34 Mon Sep 17 00:00:00 2001
2 From: Fabien Dessenne <fabien.dessenne@st.com>
3 Date: Wed, 24 Apr 2019 17:51:05 +0200
4 Subject: mailbox: stm32-ipcc: check invalid irq
5
6 [ Upstream commit 68a1c8485cf83734d4da9d81cd3b5d2ae7c0339b ]
7
8 On failure of_irq_get() returns a negative value or zero, which is
9 not handled as an error in the existing implementation.
10 Instead of using this API, use platform_get_irq() that returns
11 exclusively a negative value on failure.
12 Also, do not output an error log in case of defer probe error.
13
14 Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
15 Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
16 Signed-off-by: Sasha Levin <sashal@kernel.org>
17 ---
18 drivers/mailbox/stm32-ipcc.c | 13 ++++++++-----
19 1 file changed, 8 insertions(+), 5 deletions(-)
20
21 diff --git a/drivers/mailbox/stm32-ipcc.c b/drivers/mailbox/stm32-ipcc.c
22 index 533b0da5235d..ca1f993c0de3 100644
23 --- a/drivers/mailbox/stm32-ipcc.c
24 +++ b/drivers/mailbox/stm32-ipcc.c
25 @@ -8,9 +8,9 @@
26 #include <linux/bitfield.h>
27 #include <linux/clk.h>
28 #include <linux/interrupt.h>
29 +#include <linux/io.h>
30 #include <linux/mailbox_controller.h>
31 #include <linux/module.h>
32 -#include <linux/of_irq.h>
33 #include <linux/platform_device.h>
34 #include <linux/pm_wakeirq.h>
35
36 @@ -240,9 +240,11 @@ static int stm32_ipcc_probe(struct platform_device *pdev)
37
38 /* irq */
39 for (i = 0; i < IPCC_IRQ_NUM; i++) {
40 - ipcc->irqs[i] = of_irq_get_byname(dev->of_node, irq_name[i]);
41 + ipcc->irqs[i] = platform_get_irq_byname(pdev, irq_name[i]);
42 if (ipcc->irqs[i] < 0) {
43 - dev_err(dev, "no IRQ specified %s\n", irq_name[i]);
44 + if (ipcc->irqs[i] != -EPROBE_DEFER)
45 + dev_err(dev, "no IRQ specified %s\n",
46 + irq_name[i]);
47 ret = ipcc->irqs[i];
48 goto err_clk;
49 }
50 @@ -263,9 +265,10 @@ static int stm32_ipcc_probe(struct platform_device *pdev)
51
52 /* wakeup */
53 if (of_property_read_bool(np, "wakeup-source")) {
54 - ipcc->wkp = of_irq_get_byname(dev->of_node, "wakeup");
55 + ipcc->wkp = platform_get_irq_byname(pdev, "wakeup");
56 if (ipcc->wkp < 0) {
57 - dev_err(dev, "could not get wakeup IRQ\n");
58 + if (ipcc->wkp != -EPROBE_DEFER)
59 + dev_err(dev, "could not get wakeup IRQ\n");
60 ret = ipcc->wkp;
61 goto err_clk;
62 }
63 --
64 2.20.1
65