* [PATCH 0/2] Handle return value and error checking of platform_get_irq
@ 2017-11-23 15:55 ` Arvind Yadav
2017-11-23 15:55 ` [PATCH 1/2] extcon: adc-jack: Fix platform_get_irq's error checking Arvind Yadav
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Arvind Yadav @ 2017-11-23 15:55 UTC (permalink / raw)
To: myungjoo.ham, cw00.choi, wens; +Cc: linux-kernel
The platform_get_irq() function returns negative if an error occurs.
zero or positive number on success. platform_get_irq() error checking
for zero is not correct.
platform_get_irq() can fail here and we must check its return value.
Arvind Yadav (2):
[PATCH 1/2] extcon: adc-jack: Fix platform_get_irq's error checking
[PATCH 2/2] extcon: axp288:: Handle return value of platform_get_irq
drivers/extcon/extcon-adc-jack.c | 2 +-
drivers/extcon/extcon-axp288.c | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] extcon: adc-jack: Fix platform_get_irq's error checking
2017-11-23 15:55 ` [PATCH 0/2] Handle return value and error checking of platform_get_irq Arvind Yadav
@ 2017-11-23 15:55 ` Arvind Yadav
2017-11-23 15:55 ` [PATCH 2/2] extcon: axp288:: Handle return value of platform_get_irq Arvind Yadav
2017-11-24 0:07 ` [PATCH 0/2] Handle return value and error checking " Chanwoo Choi
2 siblings, 0 replies; 4+ messages in thread
From: Arvind Yadav @ 2017-11-23 15:55 UTC (permalink / raw)
To: myungjoo.ham, cw00.choi, wens; +Cc: linux-kernel
The platform_get_irq() function returns negative if an error occurs.
zero or positive number on success. platform_get_irq() error checking
for zero is not correct.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/extcon/extcon-adc-jack.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c
index 3877d86..1802635 100644
--- a/drivers/extcon/extcon-adc-jack.c
+++ b/drivers/extcon/extcon-adc-jack.c
@@ -144,7 +144,7 @@ static int adc_jack_probe(struct platform_device *pdev)
return err;
data->irq = platform_get_irq(pdev, 0);
- if (!data->irq) {
+ if (data->irq < 0) {
dev_err(&pdev->dev, "platform_get_irq failed\n");
return -ENODEV;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] extcon: axp288:: Handle return value of platform_get_irq
2017-11-23 15:55 ` [PATCH 0/2] Handle return value and error checking of platform_get_irq Arvind Yadav
2017-11-23 15:55 ` [PATCH 1/2] extcon: adc-jack: Fix platform_get_irq's error checking Arvind Yadav
@ 2017-11-23 15:55 ` Arvind Yadav
2017-11-24 0:07 ` [PATCH 0/2] Handle return value and error checking " Chanwoo Choi
2 siblings, 0 replies; 4+ messages in thread
From: Arvind Yadav @ 2017-11-23 15:55 UTC (permalink / raw)
To: myungjoo.ham, cw00.choi, wens; +Cc: linux-kernel
platform_get_irq() can fail here and we must check its return value.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/extcon/extcon-axp288.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
index 981fba5..e16a783 100644
--- a/drivers/extcon/extcon-axp288.c
+++ b/drivers/extcon/extcon-axp288.c
@@ -301,6 +301,9 @@ static int axp288_extcon_probe(struct platform_device *pdev)
for (i = 0; i < EXTCON_IRQ_END; i++) {
pirq = platform_get_irq(pdev, i);
+ if (pirq < 0)
+ return pirq;
+
info->irq[i] = regmap_irq_get_virq(info->regmap_irqc, pirq);
if (info->irq[i] < 0) {
dev_err(&pdev->dev,
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] Handle return value and error checking of platform_get_irq
2017-11-23 15:55 ` [PATCH 0/2] Handle return value and error checking of platform_get_irq Arvind Yadav
2017-11-23 15:55 ` [PATCH 1/2] extcon: adc-jack: Fix platform_get_irq's error checking Arvind Yadav
2017-11-23 15:55 ` [PATCH 2/2] extcon: axp288:: Handle return value of platform_get_irq Arvind Yadav
@ 2017-11-24 0:07 ` Chanwoo Choi
2 siblings, 0 replies; 4+ messages in thread
From: Chanwoo Choi @ 2017-11-24 0:07 UTC (permalink / raw)
To: Arvind Yadav, myungjoo.ham, wens; +Cc: linux-kernel
On 2017년 11월 24일 00:55, Arvind Yadav wrote:
> The platform_get_irq() function returns negative if an error occurs.
> zero or positive number on success. platform_get_irq() error checking
> for zero is not correct.
> platform_get_irq() can fail here and we must check its return value.
>
> Arvind Yadav (2):
> [PATCH 1/2] extcon: adc-jack: Fix platform_get_irq's error checking
> [PATCH 2/2] extcon: axp288:: Handle return value of platform_get_irq
>
> drivers/extcon/extcon-adc-jack.c | 2 +-
> drivers/extcon/extcon-axp288.c | 3 +++
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
Applied them.
--
Best Regards,
Chanwoo Choi
Samsung Electronics
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-11-24 0:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20171123155542epcas3p38259ac96b30879770cf72c83d199815b@epcas3p3.samsung.com>
2017-11-23 15:55 ` [PATCH 0/2] Handle return value and error checking of platform_get_irq Arvind Yadav
2017-11-23 15:55 ` [PATCH 1/2] extcon: adc-jack: Fix platform_get_irq's error checking Arvind Yadav
2017-11-23 15:55 ` [PATCH 2/2] extcon: axp288:: Handle return value of platform_get_irq Arvind Yadav
2017-11-24 0:07 ` [PATCH 0/2] Handle return value and error checking " Chanwoo Choi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.