Skip to contentSkip to conversation

driver: rtc: tps65910: Add parameter check

PATCH In review Daniel Schultz 2 participants 2 messages Mar 15, 2017 – Apr 3, 2017 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 driver: rtc: tps65910: Add parameter check

If the tps65910 driver has no interrupt, the probe of tps65910-rtc will fail.

This patch adds a check in the probe of the rtc if an interrupt exist. The check is similar to the check in the function which creates the interrupt.

---
 drivers/rtc/rtc-tps65910.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/rtc/rtc-tps65910.c +5 -0
index d0244d7..8c5ca11 100644
@@ -375,6 +375,11 @@ static int tps65910_rtc_probe(struct platform_device *pdev)
 
 	tps65910 = dev_get_drvdata(pdev->dev.parent);
 
+	if (!tps65910->chip_irq) {
+		dev_warn(&pdev->dev, "No interrupt support, not created\n");
+		return -EINVAL;
+	}
+
 	tps_rtc = devm_kzalloc(&pdev->dev, sizeof(struct tps65910_rtc),
 			GFP_KERNEL);
 	if (!tps_rtc)
Signature · 11 lines
1.9.1

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
#1 lore raw

Hi,

Quoted 7 lines · Daniel Schultz

If the tps65910 driver has no interrupt, the probe of tps65910-rtc will fail.

This patch adds a check in the probe of the rtc if an interrupt exist. The check is similar to the check in the function which creates the interrupt.

Can you elaborate on what this is fixing? If the probe already fails I'm not sure why your patch is also making it fail.

Quoted 24 lines
---
 drivers/rtc/rtc-tps65910.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/rtc/rtc-tps65910.c +5 -0
index d0244d7..8c5ca11 100644
@@ -375,6 +375,11 @@ static int tps65910_rtc_probe(struct platform_device *pdev)
 
 	tps65910 = dev_get_drvdata(pdev->dev.parent);
 
+	if (!tps65910->chip_irq) {
+		dev_warn(&pdev->dev, "No interrupt support, not created\n");
+		return -EINVAL;
+	}
+
 	tps_rtc = devm_kzalloc(&pdev->dev, sizeof(struct tps65910_rtc),
 			GFP_KERNEL);
 	if (!tps_rtc)
Signature · 1 line
1.9.1
Signature · 13 lines
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.