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=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,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 1F06CC46499 for ; Fri, 5 Jul 2019 21:25:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E8618216E3 for ; Fri, 5 Jul 2019 21:25:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LEl50FpV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E8618216E3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Ive4L+4m2Ej6cgah+Yjl0N2wS5xZpSnCu8G0gfUt/EM=; b=LEl50FpV1W6fy4 oXuk/wmjbpRhbJT6Aj5DR830CTN96YZ/iPU5qNfv79PV90Q9GphBB9uIu9s2eq8BiS1PykBeWKv5P fJcqvg48Jz7A9/lmJzeW5JJaBCFYNXbFW3n3PefZphxK4ZQbkTPvdxarx3ZwWMua0aLFLMskZugQN pGMWOrTml4BHAGZViLS4umN4n6I28y4Gvab+FQTT4+FSbcXyDh+H1pBQ0vkx6aI5yfxaBVXLrJDQv f40rWV9v4j2L2kssYlpVEFNM9+waXGM2DJvXU8vQt6+XVrdtR9PHg9LbfCex2VdEZXo829rP41R6M 16d/l+L/jvsj5MIYnb1A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hjVhj-0006J6-Be; Fri, 05 Jul 2019 21:25:15 +0000 Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hjVhf-0005vx-LZ; Fri, 05 Jul 2019 21:25:13 +0000 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 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-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.0 (2019-05-25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190705_142512_024568_68E4C74A X-CRM114-Status: GOOD ( 19.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Linus Walleij , linux-kernel@vger.kernel.org, Richard Fontana , Mauro Carvalho Chehab , "Paul E . McKenney" , Lee Jones , linux-rtc@vger.kernel.org, Rob Herring , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-pm@vger.kernel.org, Sean Wang , Rob Herring , linux-mediatek@lists.infradead.org, Matthias Brugger , Thomas Gleixner , Eddie Huang , Allison Randal , Alessandro Zummo , Josef Friedl , Greg Kroah-Hartman , Sebastian Reichel , "David S . Miller" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel