The patch titled Subject: drivers/rtc/rtc-r9701.c: fix crash in r9701_remove() has been added to the -mm tree. Its filename is drivers-rtc-rtc-r9701c-fix-crash-in-r9701_remove.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: Anatolij Gustschin <agust@xxxxxxx> Subject: drivers/rtc/rtc-r9701.c: fix crash in r9701_remove() If probing the RTC didn't succeed due to failed RTC register access, the RTC device will be unregistered. Then, when removing the module r9701_remove() causes a kernel crash while trying to unregister a not registered RTC device. Fix this by doing RTC register access test before RTC device registration. Signed-off-by: Anatolij Gustschin <agust@xxxxxxx> Cc: Alessandro Zummo <a.zummo@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/rtc/rtc-r9701.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff -puN drivers/rtc/rtc-r9701.c~drivers-rtc-rtc-r9701c-fix-crash-in-r9701_remove drivers/rtc/rtc-r9701.c --- a/drivers/rtc/rtc-r9701.c~drivers-rtc-rtc-r9701c-fix-crash-in-r9701_remove +++ a/drivers/rtc/rtc-r9701.c @@ -125,6 +125,13 @@ static int __devinit r9701_probe(struct unsigned char tmp; int res; + tmp = R100CNT; + res = read_regs(&spi->dev, &tmp, 1); + if (res || tmp != 0x20) { + dev_err(&spi->dev, "cannot read RTC register\n"); + return -ENODEV; + } + rtc = rtc_device_register("r9701", &spi->dev, &r9701_rtc_ops, THIS_MODULE); if (IS_ERR(rtc)) @@ -132,13 +139,6 @@ static int __devinit r9701_probe(struct dev_set_drvdata(&spi->dev, rtc); - tmp = R100CNT; - res = read_regs(&spi->dev, &tmp, 1); - if (res || tmp != 0x20) { - rtc_device_unregister(rtc); - return res; - } - return 0; } _ Subject: Subject: drivers/rtc/rtc-r9701.c: fix crash in r9701_remove() Patches currently in -mm which might be from agust@xxxxxxx are linux-next.patch drivers-rtc-rtc-r9701c-fix-crash-in-r9701_remove.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html