Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3543086pxj; Mon, 24 May 2021 09:02:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwylz32pTFdtUEM1uyd4P4u2f9NS5PdR3XSyFj7ikJUayd53bCWcvSfxG7l168AfmMRUwIn X-Received: by 2002:a05:6638:3290:: with SMTP id f16mr25512806jav.49.1621872148964; Mon, 24 May 2021 09:02:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621872148; cv=none; d=google.com; s=arc-20160816; b=VongJPEhDJWrvQacWCdXnDAtA5ogWvlkELbNqh6MjLerxZrcIlt7gPH7rto0cTa95K UxR2Pfl52OiBpFuBJwyXjMXEOYcmW7qmqeLk5yqk4u6KgEmsIFBNSXKWROZVQt3XHLX5 q6OwxWhi8WkgiK3QMrOPfYtqU2O9K7ZXyi1OM2+VoTYJDlRKA93io9etu8bfS59SQ802 ZCR2n6MVMEjcaglcx/OAOHLdCj4ko9cN1CGz+YxHID8FQqLHHMhc/ZVEFy06cVSMdQEA bV8co3guymeNPUwUn83WvXgaqtxE6wfMp4EcX6TxJQNGlQY5JDZiW1tKW7K/hgVOalCw eMBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=St2CvBuqukgxTgLWNGblKdch6Y8ci95EHdgcn4sIBZk=; b=Qrb0UBJuJ9vZqqO2Jc9Tk7bQyIi1Ac2fflr3XIy1Z8MWa44nPZTlOkcMOI0K6wDtXw mIAOWzUFdf9GZIJNSmsE7fXAKahCNlA7/O6q17Lu0Nge2KpEyYxVsTDj+CxMmP2VqNR5 aFMxQOEYcrYillr0alPoqEcjnNxcC2vyjXXD0DOjuRs/woEsfeFVM/AEh3XOLPqvmLb5 nJksf+UpXbkqA/skEX/B1fhNkGLW8SIubbK3d00/rbEUdOpAmPh8xyqvUfnawRVh2HUt a1MDG2tcpA9OEP96FrGZPyarRKFGHMdqYYf9CQyttHSmmaxhgt5OiR/iJkwGVWGS/k2M J2gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0KPFO3bS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m12si14446390jav.104.2021.05.24.09.02.11; Mon, 24 May 2021 09:02:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0KPFO3bS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235785AbhEXQCW (ORCPT + 99 others); Mon, 24 May 2021 12:02:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:39020 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235095AbhEXPzp (ORCPT ); Mon, 24 May 2021 11:55:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 447DD61942; Mon, 24 May 2021 15:42:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621870935; bh=tTbS9qsh48BgZ/xZUmWnHXd55ELDUM8yD8OjGeVeY4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0KPFO3bSV+JVKZr1UoB00yy7O0rkefalk5RSs3++SH6ZIfcUcCyKVPSfqHom0ezGP HjQVHWGt03vL/t9RsBnUEVVpzO9c8NcxLFvFGC1q8EjTMrJqBK9QHm5UquBGCm41Qe gZsB9oDGw9SuulSwRZUE+mF/M4VyezzD+Hgyy+fU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Francois Gervais , Alexandre Belloni Subject: [PATCH 5.10 103/104] rtc: pcf85063: fallback to parent of_node Date: Mon, 24 May 2021 17:26:38 +0200 Message-Id: <20210524152336.267728819@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152332.844251980@linuxfoundation.org> References: <20210524152332.844251980@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Francois Gervais commit 03531606ef4cda25b629f500d1ffb6173b805c05 upstream. The rtc device node is always NULL. Since v5.12-rc1-dontuse/3c9ea42802a1fbf7ef29660ff8c6e526c58114f6 this will lead to a NULL pointer dereference. To fix this use the parent node which is the i2c client node as set by devm_rtc_allocate_device(). Using the i2c client node seems to be what other similar drivers do e.g. rtc-pcf8563.c. Signed-off-by: Francois Gervais Signed-off-by: Alexandre Belloni Link: https://lore.kernel.org/r/20210310211026.27299-1-fgervais@distech-controls.com Signed-off-by: Greg Kroah-Hartman --- drivers/rtc/rtc-pcf85063.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/drivers/rtc/rtc-pcf85063.c +++ b/drivers/rtc/rtc-pcf85063.c @@ -486,6 +486,7 @@ static struct clk *pcf85063_clkout_regis { struct clk *clk; struct clk_init_data init; + struct device_node *node = pcf85063->rtc->dev.parent->of_node; init.name = "pcf85063-clkout"; init.ops = &pcf85063_clkout_ops; @@ -495,15 +496,13 @@ static struct clk *pcf85063_clkout_regis pcf85063->clkout_hw.init = &init; /* optional override of the clockname */ - of_property_read_string(pcf85063->rtc->dev.of_node, - "clock-output-names", &init.name); + of_property_read_string(node, "clock-output-names", &init.name); /* register the clock */ clk = devm_clk_register(&pcf85063->rtc->dev, &pcf85063->clkout_hw); if (!IS_ERR(clk)) - of_clk_add_provider(pcf85063->rtc->dev.of_node, - of_clk_src_simple_get, clk); + of_clk_add_provider(node, of_clk_src_simple_get, clk); return clk; }