+ rtc-fixed-potential-race-condition.patch added to -mm tree
Subject: + rtc-fixed-potential-race-condition.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Tue, 01 Apr 2014 13:15:52 -0700
The patch titled
Subject: rtc: fix potential race condition
has been added to the -mm tree. Its filename is
rtc-fixed-potential-race-condition.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/rtc-fixed-potential-race-condition.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/rtc-fixed-potential-race-condition.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Alessandro Zummo <[email protected]>
Subject: rtc: fix potential race condition
RTC drivers must not return an error after device registration.
---
drivers/rtc/rtc-ds1305.c | 10 ++---- drivers/rtc/rtc-ds1307.c | 56 +++++++++++++++++++------------------ drivers/rtc/rtc-ds1511.c | 18 ++++++----- drivers/rtc/rtc-ds1553.c | 18 ++++++----- drivers/rtc/rtc-ds1672.c | 13 +++----- drivers/rtc/rtc-ds1742.c | 5 ++- drivers/rtc/rtc-ds3232.c | 2 - drivers/rtc/rtc-test.c | 11 ++----- drivers/rtc/rtc-x1205.c | 5 +-- 9 files changed, 70 insertions(+), 68 deletions(-)
drivers/rtc/rtc-ds1305.c renamed from drivers/rtc/rtc-ds1305.c~rtc-fixed-potential-race-condition +4 -6
@@ -756,19 +756,17 @@ static int ds1305_probe(struct spi_devic status =devm_request_irq (&spi->dev, spi->irq, ds1305_irq,0 ,dev_name (&ds1305->rtc->dev), ds1305);if (status <0 ) { -dev_dbg (&spi->dev,"request_irq %d --> %d\n" , +dev_err (&spi->dev,"request_irq %d --> %d\n" , spi->irq, status); -return status; + }else { +device_set_wakeup_capable (&spi->dev,1 ); } - -device_set_wakeup_capable (&spi->dev,1 ); }/* export NVRAM */ status =sysfs_create_bin_file (&spi->dev.kobj, &nvram);if (status <0 ) { -dev_dbg (&spi->dev,"register nvram --> %d\n" , status); -return status; +dev_err (&spi->dev,"register nvram --> %d\n" , status); }return 0 ;
drivers/rtc/rtc-ds1307.c renamed from drivers/rtc/rtc-ds1307.c~rtc-fixed-potential-race-condition +29 -27
81 lines not on this page · raw message
drivers/rtc/rtc-ds1511.c renamed from drivers/rtc/rtc-ds1511.c~rtc-fixed-potential-race-condition +10 -8
@@ -473,7 +473,6 @@ static struct bin_attribute ds1511_nvramstatic int ds1511_rtc_probe (struct platform_device *pdev) { -struct rtc_device *rtc;struct resource *res;struct rtc_plat_data *pdata;int ret =0 ;
@@ -512,6 +511,12 @@ static int ds1511_rtc_probe(struct platfspin_lock_init (&pdata->lock);platform_set_drvdata (pdev, pdata); + + pdata->rtc =devm_rtc_device_register (&pdev->dev, pdev->name, &ds1511_rtc_ops, +THIS_MODULE ); +if (IS_ERR (pdata->rtc)) +return PTR_ERR (pdata->rtc); +/* * if the platform has an interrupt in mind for this device, * then by all means, set it
@@ -526,15 +531,12 @@ static int ds1511_rtc_probe(struct platf } } - rtc =devm_rtc_device_register (&pdev->dev, pdev->name, &ds1511_rtc_ops, -THIS_MODULE ); -if (IS_ERR (rtc)) -return PTR_ERR (rtc); - pdata->rtc = rtc; - ret =sysfs_create_bin_file (&pdev->dev.kobj, &ds1511_nvram_attr); +if (ret) { +dev_err (&pdev->dev,"Unable to create sysfs entry: %s\n" , ds1511_nvram_attr.attr.name); + } -return ret; +return 0 ; }static int ds1511_rtc_remove (struct platform_device *pdev)
drivers/rtc/rtc-ds1553.c renamed from drivers/rtc/rtc-ds1553.c~rtc-fixed-potential-race-condition +10 -8
@@ -278,7 +278,6 @@ static struct bin_attribute ds1553_nvramstatic int ds1553_rtc_probe (struct platform_device *pdev) { -struct rtc_device *rtc;struct resource *res;unsigned int cen, sec;struct rtc_plat_data *pdata;
@@ -311,6 +310,12 @@ static int ds1553_rtc_probe(struct platfspin_lock_init (&pdata->lock); pdata->last_jiffies = jiffies;platform_set_drvdata (pdev, pdata); + + pdata->rtc =devm_rtc_device_register (&pdev->dev, pdev->name, + &ds1553_rtc_ops,THIS_MODULE ); +if (IS_ERR (pdata->rtc)) +return PTR_ERR (pdata->rtc); +if (pdata->irq >0 ) {writeb (0 , ioaddr +RTC_INTERRUPTS ); if (devm_request_irq(&pdev->dev, pdata->irq,
@@ -321,15 +326,12 @@ static int ds1553_rtc_probe(struct platf } } - rtc =devm_rtc_device_register (&pdev->dev, pdev->name, - &ds1553_rtc_ops,THIS_MODULE ); -if (IS_ERR (rtc)) -return PTR_ERR (rtc); - pdata->rtc = rtc; - ret =sysfs_create_bin_file (&pdev->dev.kobj, &ds1553_nvram_attr); +if (ret) { +dev_err (&pdev->dev,"unable to create sysfs file: %s\n" , ds1553_nvram_attr.attr.name); + } -return ret; +return 0 ; }static int ds1553_rtc_remove (struct platform_device *pdev)
drivers/rtc/rtc-ds1672.c renamed from drivers/rtc/rtc-ds1672.c~rtc-fixed-potential-race-condition +6 -7
@@ -177,8 +177,9 @@ static int ds1672_probe(struct i2c_clien/* read control register */ err =ds1672_get_control (client, &control); -if (err) - goto exit_devreg; +if (err) { +dev_warn (&client->dev,"Unable to read the control register\n" ); + }if (control &DS1672_REG_CONTROL_EOSC ) dev_warn(&client->dev, "Oscillator not enabled. "
@@ -186,13 +187,11 @@ static int ds1672_probe(struct i2c_clien/* Register sysfs hooks */ err =device_create_file (&client->dev, &dev_attr_control); -if (err) - goto exit_devreg; +if (err) { +dev_err (&client->dev,"Unable to create sysfs entry: %s\n" , dev_attr_control.attr.name); + }return 0 ; - - exit_devreg: -return err; }static struct i2c_device_id ds1672_id[] = {
drivers/rtc/rtc-ds1742.c renamed from drivers/rtc/rtc-ds1742.c~rtc-fixed-potential-race-condition +4 -1
@@ -204,8 +204,11 @@ static int ds1742_rtc_probe(struct platfreturn PTR_ERR (rtc); ret =sysfs_create_bin_file (&pdev->dev.kobj, &pdata->nvram_attr); +if (ret) { +dev_err (&pdev->dev,"Unable to create sysfs entry: %s\n" , pdata->nvram_attr.attr.name); + } -return ret; +return 0 ; }static int ds1742_rtc_remove (struct platform_device *pdev)
drivers/rtc/rtc-ds3232.c renamed from drivers/rtc/rtc-ds3232.c~rtc-fixed-potential-race-condition +0 -2
@@ -414,7 +414,6 @@ static int ds3232_probe(struct i2c_clien ds3232->rtc =devm_rtc_device_register (&client->dev, client->name, &ds3232_rtc_ops,THIS_MODULE );if (IS_ERR (ds3232->rtc)) { -dev_err (&client->dev,"unable to register the class device\n" );return PTR_ERR (ds3232->rtc); }
@@ -423,7 +422,6 @@ static int ds3232_probe(struct i2c_clien "ds3232", client);if (ret) {dev_err (&client->dev,"unable to request IRQ\n" ); -return ret; } }
drivers/rtc/rtc-test.c renamed from drivers/rtc/rtc-test.c~rtc-fixed-potential-race-condition +4 -7
@@ -104,20 +104,17 @@ static int test_probe(struct platform_de rtc =devm_rtc_device_register (&plat_dev->dev,"test" , &test_rtc_ops,THIS_MODULE );if (IS_ERR (rtc)) { - err =PTR_ERR (rtc); -return err; +return PTR_ERR (rtc); } err =device_create_file (&plat_dev->dev, &dev_attr_irq); -if (err) - goto err; +if (err) { +dev_err (&plat_dev->dev,"Unable to create sysfs entry: %s\n" , dev_attr_irq.attr.name); + }platform_set_drvdata (plat_dev, rtc);return 0 ; - -err: -return err; }static int test_remove (struct platform_device *plat_dev)
drivers/rtc/rtc-x1205.c renamed from drivers/rtc/rtc-x1205.c~rtc-fixed-potential-race-condition +3 -2
@@ -659,8 +659,9 @@ static int x1205_probe(struct i2c_client } err =x1205_sysfs_register (&client->dev); -if (err) -return err; +if (err) { +dev_err (&client->dev,"Unable to create sysfs entries\n" ); + }return 0 ; }
_
Patches currently in -mm which might be from [email protected] are
rtc-fixed-potential-race-condition.patch rtc-fixed-potential-race-condition-checkpatch-fixes.patch rtc-verify-a-critical-argument-to-rtc_update_irq-before-using-it.patch rtc-pm8xxx-fixup-checkpatch-style-issues.patch rtc-pm8xxx-use-regmap-api-for-register-accesses.patch rtc-pm8xxx-use-devm_request_any_context_irq.patch rtc-pm8xxx-add-support-for-devicetree.patch rtc-pm8xxx-move-device_init_wakeup-before-rtc_register.patch drivers-rtc-rtc-mc13xxxc-fix-potential-race-condition.patch rtc-add-support-for-maxim-dallas-rtc-ds1347.patch