Received: by 10.213.65.68 with SMTP id h4csp1051731imn; Wed, 28 Mar 2018 19:19:30 -0700 (PDT) X-Google-Smtp-Source: AIpwx49BazyXYydiOtgv8dJ2wqosyCxEqD/HU+S0w49PLG2oFgsoTDtLzXovzjlq6YG1w+WViNAS X-Received: by 2002:a17:902:33a5:: with SMTP id b34-v6mr1407734plc.232.1522289970338; Wed, 28 Mar 2018 19:19:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522289970; cv=none; d=google.com; s=arc-20160816; b=Xov6HXG59BbrMyagzGVaFzZSIiBfBBbdFPK8frlI6jaRhVIp5Ru3gU0klE0kGzA7cw PEK3cFS6PArjqTwcIcVGwBKXnJVcIJDMJLH68FhlaOONAf05VB7VDFivV72tL64A0Yg2 t6WkoY+SEjEEJGn51CJ3ztrvhmWkXRXjSG6PIkfAPFCQ/8KgBVSsFeHgbaEOjjFseHvR Jt6qZS8UFMAoVogGaJu+BI0bp5fio+ZRiCApOIuBRoeSD73t1bGeNL6fH0uNHr6zGz4I IqHKPQhQ22DkC6t5dUaY78YPRO7oMWHR4GRq/KnpPVqd+NgzEfaVdrlblXea73wRRH30 pXRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=Ojf6fDcqOf5OMnQr6opUCQ1chuVTU+CHdX/iA155GR4=; b=r7Cc2LFGDGjG/0Z+GtVBsfcWv53k2/yQcZvLAxu7JR/A3NUDbwc3ZyYOBvbO8Cmdd9 UyDvhKtaVzpBCrIciHX8/sTfh+p61ZdYIjEqNTsdtcJYwF50z7s15MBaISCCQmrLAfz0 0R4THU9/F/vecE76pW259YTj+0v0dAr4PPkJWVWpWU8egbwHqzpvdxecHq0uaUEVAxu9 AMPSmiftqxK+O0AkTUcje2xYCMXsRBA3Mj2cfomCyDmqNyBYmDMANAy56pzIiXlpW8T7 xEOMcc7ia/3km+xlaV8HsOu9YQ4jpjTVr3U+v3i2c0bgh7F8vnrriJ0SQJ4u9J7WOM0I rs+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K9MME2+v; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h16-v6si4743316pli.408.2018.03.28.19.19.16; Wed, 28 Mar 2018 19:19:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K9MME2+v; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751146AbeC2CSZ (ORCPT + 99 others); Wed, 28 Mar 2018 22:18:25 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:35150 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750774AbeC2CSX (ORCPT ); Wed, 28 Mar 2018 22:18:23 -0400 Received: by mail-pg0-f65.google.com with SMTP id j3so2095803pgf.2 for ; Wed, 28 Mar 2018 19:18:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Ojf6fDcqOf5OMnQr6opUCQ1chuVTU+CHdX/iA155GR4=; b=K9MME2+v+O7NJ90oCs6ujPQ7da5qFEOqrdbdGtwTRLAX9KV8s+0u8KPbqHEemNiH8N 4h9PpX+b/y7QkNwJ/w6oWDZT8XNQ1/nhMcB8isQ9m61GFJ1QSugeEnOlIGrZ+pL6H+uP CL1AYPJWK4ValinQWnzFUXHUxd7H9MtpC1H1A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Ojf6fDcqOf5OMnQr6opUCQ1chuVTU+CHdX/iA155GR4=; b=VfoBqGSuBg48nZcpaZ1ZmQpoqi70f48HdayIRRerUUNsLLIahbZG4L0cFnwCBA9iC0 blQxwhB/BBEzGaC6iL42EC//2d+MZjR9PK1m/o5t78U39w89fQnX23D2VGUUqwnoiMAA O3xia8R1ZZYz/gmzwRswwCRRUBSxBiVv4ivwO1pMWZ/ZDW9b9ftKepwK/yiQxaSJR3Um PicXBC5vf83n8OTq7bOV6L3/Cvo8efC8AgRsdqMSg1drVyzSMhJ9T2IOAJhMfWAGwNkW w2bcIISnJptwME+tGkzBgIDnevCrQ/vxGi3wR+Tbz5dy1eY8lU5ltGkOmqojpwgphrQW ZurQ== X-Gm-Message-State: AElRT7HTqp6dOQ0KEdvWMr1AGyZ8UqIlJ/OKFzUpCZSmZmKt0t+Tn1Yp 7U66U0aAma9H4ARCz/m+Dq+ijw== X-Received: by 2002:a17:902:6bc1:: with SMTP id m1-v6mr6241144plt.111.1522289902860; Wed, 28 Mar 2018 19:18:22 -0700 (PDT) Received: from dragon ([45.56.152.247]) by smtp.gmail.com with ESMTPSA id g11sm9641970pfi.15.2018.03.28.19.18.18 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 28 Mar 2018 19:18:21 -0700 (PDT) Date: Thu, 29 Mar 2018 10:18:06 +0800 From: Shawn Guo To: Bryan O'Donoghue Cc: alexandre.belloni@free-electrons.com, linux-kernel@vger.kernel.org, a.zummo@towertech.it, Pan Bian , Guy Shapiro , Stefan Agner , Frank Li , linux-rtc@vger.kernel.org, "# v3 . 16+" Subject: Re: [RESEND] [PATCH] rtc: snvs: Fix usage of snvs_rtc_enable Message-ID: <20180329021803.GI27302@dragon> References: <1522264445-2398-1-git-send-email-pure.logic@nexus-software.ie> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1522264445-2398-1-git-send-email-pure.logic@nexus-software.ie> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 28, 2018 at 08:14:05PM +0100, Bryan O'Donoghue wrote: > commit 179a502f8c46 ("rtc: snvs: add Freescale rtc-snvs driver") introduces > the SNVS RTC driver with a function snvs_rtc_enable(). > > snvs_rtc_enable() can return an error on the enable path however this > driver does not currently trap that failure on the probe() path and > consequently if enabling the RTC fails we encounter a later error spinning > forever in rtc_write_sync_lp(). > > [ 36.093481] [] (__irq_svc) from [] (_raw_spin_unlock_irqrestore+0x34/0x44) > [ 36.102122] [] (_raw_spin_unlock_irqrestore) from [] (regmap_read+0x4c/0x5c) > [ 36.110938] [] (regmap_read) from [] (rtc_write_sync_lp+0x6c/0x98) > [ 36.118881] [] (rtc_write_sync_lp) from [] (snvs_rtc_alarm_irq_enable+0x40/0x4c) > [ 36.128041] [] (snvs_rtc_alarm_irq_enable) from [] (rtc_timer_do_work+0xd8/0x1a8) > [ 36.137291] [] (rtc_timer_do_work) from [] (process_one_work+0x28c/0x76c) > [ 36.145840] [] (process_one_work) from [] (worker_thread+0x34/0x58c) > [ 36.153961] [] (worker_thread) from [] (kthread+0x138/0x150) > [ 36.161388] [] (kthread) from [] (ret_from_fork+0x14/0x20) > [ 36.168635] rcu_sched kthread starved for 2602 jiffies! g496 c495 f0x2 RCU_GP_WAIT_FQS(3) ->state=0x0 ->cpu=0 > [ 36.178564] rcu_sched R running task 0 8 2 0x00000000 > [ 36.185664] [] (__schedule) from [] (schedule+0x3c/0xa0) > [ 36.192739] [] (schedule) from [] (schedule_timeout+0x78/0x4e0) > [ 36.200422] [] (schedule_timeout) from [] (rcu_gp_kthread+0x648/0x1864) > [ 36.208800] [] (rcu_gp_kthread) from [] (kthread+0x138/0x150) > [ 36.216309] [] (kthread) from [] (ret_from_fork+0x14/0x20) > > This patch fixes by parsing the result of rtc_write_sync_lp() and > propagating both in the probe and elsewhere. If the RTC doesn't start we > don't proceed loading the driver and don't get into this loop mess later > on. > > Fixes: 179a502f8c46 ("rtc: snvs: add Freescale rtc-snvs driver") > > Signed-off-by: Bryan O'Donoghue > Cc: a.zummo@towertech.it > Cc: alexandre.belloni@free-electrons.com > Cc: Pan Bian > Cc: Guy Shapiro > Cc: Stefan Agner > Cc: Frank Li > Cc: Shawn Guo Acked-by: Shawn Guo