]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.4.9/rtc-max77686-properly-handle-regmap_irq_get_virq-error-code.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.9 / rtc-max77686-properly-handle-regmap_irq_get_virq-error-code.patch
CommitLineData
81e265ea
GKH
1From fb166ba1d7f0a662f7332f4ff660a0d6f4d76915 Mon Sep 17 00:00:00 2001
2From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
3Date: Thu, 4 Feb 2016 09:26:35 +0900
4Subject: rtc: max77686: Properly handle regmap_irq_get_virq() error code
5
6From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
7
8commit fb166ba1d7f0a662f7332f4ff660a0d6f4d76915 upstream.
9
10The regmap_irq_get_virq() can return 0 or -EINVAL in error conditions
11but driver checked only for value of 0.
12
13This could lead to a cast of -EINVAL to an unsigned int used as a
14interrupt number for devm_request_threaded_irq(). Although this is not
15yet fatal (devm_request_threaded_irq() will just fail with -EINVAL) but
16might be a misleading when diagnosing errors.
17
18Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
19Fixes: 6f1c1e71d933 ("mfd: max77686: Convert to use regmap_irq")
20Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
21Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
22Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23
24---
25 drivers/rtc/rtc-max77686.c | 2 +-
26 1 file changed, 1 insertion(+), 1 deletion(-)
27
28--- a/drivers/rtc/rtc-max77686.c
29+++ b/drivers/rtc/rtc-max77686.c
30@@ -465,7 +465,7 @@ static int max77686_rtc_probe(struct pla
31
32 info->virq = regmap_irq_get_virq(max77686->rtc_irq_data,
33 MAX77686_RTCIRQ_RTCA1);
34- if (!info->virq) {
35+ if (info->virq <= 0) {
36 ret = -ENXIO;
37 goto err_rtc;
38 }