From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C88A7C46499 for ; Fri, 5 Jul 2019 21:25:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ACBDA216E3 for ; Fri, 5 Jul 2019 21:25:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727008AbfGEVZB (ORCPT ); Fri, 5 Jul 2019 17:25:01 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:58063 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726061AbfGEVZB (ORCPT ); Fri, 5 Jul 2019 17:25:01 -0400 X-Originating-IP: 90.65.161.137 Received: from localhost (lfbn-1-1545-137.w90-65.abo.wanadoo.fr [90.65.161.137]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 5B1981C0003; Fri, 5 Jul 2019 21:24:48 +0000 (UTC) Date: Fri, 5 Jul 2019 23:24:48 +0200 From: Alexandre Belloni To: Frank Wunderlich Cc: Lee Jones , Rob Herring , Mark Rutland , Matthias Brugger , Sean Wang , Sebastian Reichel , Alessandro Zummo , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-rtc@vger.kernel.org, Eddie Huang , Thomas Gleixner , Richard Fontana , Allison Randal , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Rob Herring , Linus Walleij , Nicolas Ferre , "Paul E . McKenney" , Josef Friedl Subject: Re: Re: [PATCH v2 3/7] rtc: mt6397: improvements of rtc driver Message-ID: <20190705212448.GB12409@piout.net> References: <20190703164822.17924-1-frank-w@public-files.de> <20190703164822.17924-4-frank-w@public-files.de> <20190704204336.GJ3692@piout.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.0 (2019-05-25) Sender: linux-rtc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rtc@vger.kernel.org On 05/07/2019 17:35:46+0200, Frank Wunderlich wrote: > Hi Alexander, > > thank you for the Review > > > Gesendet: Donnerstag, 04. Juli 2019 um 22:43 Uhr > > Von: "Alexandre Belloni" > > > - rtc->rtc_dev = devm_rtc_allocate_device(rtc->dev); > > > - if (IS_ERR(rtc->rtc_dev)) > > > - return PTR_ERR(rtc->rtc_dev); > > > + ret = devm_request_threaded_irq(&pdev->dev, rtc->irq, NULL, > > > + mtk_rtc_irq_handler_thread, > > > + IRQF_ONESHOT | IRQF_TRIGGER_HIGH, > > > + "mt6397-rtc", rtc); > > > > > > > This change may lead to a crash and the allocation was intentionally > > placed before the irq request. > > i got no crash till now, but i will try to move the allocation before irq-request > Let's say the RTC has been used to start your platform, then the irq handler will be called as soon as the irq is requested, leading to a null pointer dereference. > > > - ret = request_threaded_irq(rtc->irq, NULL, > > > - mtk_rtc_irq_handler_thread, > > > - IRQF_ONESHOT | IRQF_TRIGGER_HIGH, > > > - "mt6397-rtc", rtc); > > > if (ret) { > > > dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", > > > rtc->irq, ret); > > > @@ -287,6 +281,10 @@ static int mtk_rtc_probe(struct platform_device *pdev) > > > > > > device_init_wakeup(&pdev->dev, 1); > > > > > > + rtc->rtc_dev = devm_rtc_allocate_device(&pdev->dev); > > > + if (IS_ERR(rtc->rtc_dev)) > > > + return PTR_ERR(rtc->rtc_dev); > > > + > > > rtc->rtc_dev->ops = &mtk_rtc_ops; > > > > > static const struct of_device_id mt6397_rtc_of_match[] = { > > > + { .compatible = "mediatek,mt6323-rtc", }, > > > > Unrelated change, this is not an improvement and must be accompanied by > > a documentation change. > > documentation is changed in 1/7 defining this compatible. i called it improvement because existing driver now supports another chip > Yes and IIRC, I did comment that the rtc change also had to be separated from 1/7. Also, I really doubt this new compatible is necessary at all as you could simply directly use mediatek,mt6397-rtc. -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com