linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFT] rtc: da9063: Handle invalid IRQ from platform_get_irq_byname()
@ 2019-10-04 15:05 Krzysztof Kozlowski
  2019-10-07 10:40 ` Adam Thomson
  2019-10-07 13:50 ` Alexandre Belloni
  0 siblings, 2 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2019-10-04 15:05 UTC (permalink / raw)
  To: Support Opensource, Alessandro Zummo, Alexandre Belloni,
	linux-rtc, linux-kernel
  Cc: Krzysztof Kozlowski

platform_get_irq_byname() might return -errno which later would be
cast to an unsigned int and used in request_irq().

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

---

Not marking as cc-stable as this was not reproduced and not tested.
---
 drivers/rtc/rtc-da9063.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/rtc/rtc-da9063.c b/drivers/rtc/rtc-da9063.c
index 15908d51b1cb..046b1d4c3dae 100644
--- a/drivers/rtc/rtc-da9063.c
+++ b/drivers/rtc/rtc-da9063.c
@@ -483,6 +483,9 @@ static int da9063_rtc_probe(struct platform_device *pdev)
 		rtc->rtc_dev->uie_unsupported = 1;
 
 	irq_alarm = platform_get_irq_byname(pdev, "ALARM");
+	if (irq_alarm < 0)
+		return irq_alarm;
+
 	ret = devm_request_threaded_irq(&pdev->dev, irq_alarm, NULL,
 					da9063_alarm_event,
 					IRQF_TRIGGER_LOW | IRQF_ONESHOT,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [RFT] rtc: da9063: Handle invalid IRQ from platform_get_irq_byname()
  2019-10-04 15:05 [RFT] rtc: da9063: Handle invalid IRQ from platform_get_irq_byname() Krzysztof Kozlowski
@ 2019-10-07 10:40 ` Adam Thomson
  2019-10-07 13:50 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Adam Thomson @ 2019-10-07 10:40 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Support Opensource, Alessandro Zummo,
	Alexandre Belloni, linux-rtc, linux-kernel

On 04 October 2019 16:05, Krzysztof Kozlowski wrote:

> platform_get_irq_byname() might return -errno which later would be
> cast to an unsigned int and used in request_irq().
> 
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

This doesn't break the existing RTC functionality when running up on my test
board with DA9063. Although very unlikely to occur it does make sense so:

Tested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

> 
> ---
> 
> Not marking as cc-stable as this was not reproduced and not tested.
> ---
>  drivers/rtc/rtc-da9063.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-da9063.c b/drivers/rtc/rtc-da9063.c
> index 15908d51b1cb..046b1d4c3dae 100644
> --- a/drivers/rtc/rtc-da9063.c
> +++ b/drivers/rtc/rtc-da9063.c
> @@ -483,6 +483,9 @@ static int da9063_rtc_probe(struct platform_device
> *pdev)
>  		rtc->rtc_dev->uie_unsupported = 1;
> 
>  	irq_alarm = platform_get_irq_byname(pdev, "ALARM");
> +	if (irq_alarm < 0)
> +		return irq_alarm;
> +
>  	ret = devm_request_threaded_irq(&pdev->dev, irq_alarm, NULL,
>  					da9063_alarm_event,
>  					IRQF_TRIGGER_LOW | IRQF_ONESHOT,
> --

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFT] rtc: da9063: Handle invalid IRQ from platform_get_irq_byname()
  2019-10-04 15:05 [RFT] rtc: da9063: Handle invalid IRQ from platform_get_irq_byname() Krzysztof Kozlowski
  2019-10-07 10:40 ` Adam Thomson
@ 2019-10-07 13:50 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2019-10-07 13:50 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Support Opensource, Alessandro Zummo, linux-rtc, linux-kernel

On 04/10/2019 17:05:10+0200, Krzysztof Kozlowski wrote:
> platform_get_irq_byname() might return -errno which later would be
> cast to an unsigned int and used in request_irq().
> 
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> 
> ---
> 
> Not marking as cc-stable as this was not reproduced and not tested.
> ---
>  drivers/rtc/rtc-da9063.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
Applied, thanks.

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-07 13:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-04 15:05 [RFT] rtc: da9063: Handle invalid IRQ from platform_get_irq_byname() Krzysztof Kozlowski
2019-10-07 10:40 ` Adam Thomson
2019-10-07 13:50 ` Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).