Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3551074pxj; Mon, 24 May 2021 09:11:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwhKyKc0Pp2XyBr5rlzEbzHYxCHcChEGLNCR60HXPy9k8PT18nn2LZ2OLMzlI4ZwFbEoVk X-Received: by 2002:a17:907:2855:: with SMTP id el21mr24263299ejc.153.1621872660214; Mon, 24 May 2021 09:11:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621872660; cv=none; d=google.com; s=arc-20160816; b=ZAuVlSM9qdkAKrlJ+dQWLeQcL3Ygn20itlowu4lt07OHIBd0Z90dhv3D8LMZRbwZEy 1q735QGGTCPq5DsbyIfMfYaKVeiNw3YTsqT6vJ1qzAmX+AleoxESJ9OU/SsJ39/civGk pkH2CHKvT6SawiboI+Y7uhofISrUHhdGeq1E46jpiwQyt5vzUjzZhbpkYh0qRzZizcG9 O1qMYY7W6gnV9sn1MvBs/EkE+ACO6TSbkLUybyorrbGW2rLuF4NWfH4lM+AbHKDKNNKO We9IFw/f3nNfPbECRusGVebyTcw+zh4n4F8rZHrxmIFQtGi6Cb5fASGsrAs90VqM36Xh KcNA== 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=ajPUa1Pa/MM8/73OOialeGsCG3K5uRydE5LLNGoPJQU=; b=ZR1oE0ikUI47QAljlIl3Yk/jKf4j2AFb6cdfCJAiSKHqTjpzDfyWARVx3lZ5pMwNAh KgcQ7kbLqdOm6H/YId8WgdVbV4H/6gygU8oZ1OtzeqdRZBhdvZPsuNw5bVLVnG9Nwyqq 46joXO1HCb8eZMU1kePD17Ss1DfO9wQyWVohOFM6G1XDuPnHSc0gEcLMQgHLk5NM8KJp VPYXRiJEUk9e+S1YSWbc3E743bW1ePF3PGprBe+2VQQDiY4aVoFeBmZMUY8n6Qhf90Ne A/AOXfa5avREMo3jwR8keUW5EgilxifUIaoUfmoi8iws9AWROloj93MF1yq4/8SXBn00 TCTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RBVU7Iv2; 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 gf1si13161790ejb.318.2021.05.24.09.10.37; Mon, 24 May 2021 09:11:00 -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=RBVU7Iv2; 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 S238226AbhEXQJ5 (ORCPT + 99 others); Mon, 24 May 2021 12:09:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:48522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236044AbhEXQB0 (ORCPT ); Mon, 24 May 2021 12:01:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 12CA361999; Mon, 24 May 2021 15:46:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621871215; bh=6g7EKuAx+B1sHevOOQJLjxI5YvhWiM5LZ06ZpqD/81E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RBVU7Iv2e3HF3Z5Vld4tp9KBswYdu5f4fCzAnoOOlb4NLq1w7vwfTIiXSDdjhg/JI Y8q/r7p5qByLvdePDtyVYB9AEQGBQrXidUzzmDrqLHzGAsDtH7EyRPepSxnVcurEVL FcpvJHd5S6DzxtyBjCufFMbw88DFB/PReZuZGnmU= 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.12 126/127] rtc: pcf85063: fallback to parent of_node Date: Mon, 24 May 2021 17:27:23 +0200 Message-Id: <20210524152339.124036736@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152334.857620285@linuxfoundation.org> References: <20210524152334.857620285@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 @@ -478,6 +478,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; @@ -487,15 +488,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; }