From patchwork Sun Oct 6 17:20:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 175296 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3307382ill; Sun, 6 Oct 2019 10:42:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqyDrVihmjCpE0DWkrRLLFrg4vxhwXufflwDXFBDC1w4xtD8VjqpMFz7jAb+aMTNnCwVL5o9 X-Received: by 2002:a50:9fce:: with SMTP id c72mr25956488edf.166.1570383736416; Sun, 06 Oct 2019 10:42:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570383736; cv=none; d=google.com; s=arc-20160816; b=mFcxyfKkMuW7u3dRRqlqGsVBuE35/i6i20C176wCTiV2BeidcrPqgtLNOWLPmG7u71 ziT6WyRyMly4XLg5sPYJvAVVJmm20GIoyT31ozTqf6zuTrrEQhKsiQGYmWTq1qyW0Tp2 X8FTTxLsY9gxDOU9u9Do9c8FLUClh8ebcA1Fe9UEwKjCVDr939Iyx83y0yoIM6JudhK/ lyydTCN55RME2uafXtlyk3OZOKTowy2o9aritLyOBJkPyeCwLYmCj5FlhqCBxHpQWUBr b+5/uhh4GjqD+oH9wzZcdEdT30LoTiFgEABymcRxDXCMPmGLJFzYopYk+e1zS0Fw4iWy L0kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9q/QhvSxlOQBgtgkWSiifKTjIpKnhmPDUh3hZpZm9gU=; b=Lmr8Zs8HuiNQbOmOtr2Zcd8sVXHZjSldxMFpqgPdFVEb8MZDf0e4mEja5FSJ1xTxf3 jet0l2y3m8wDKM7KLb+KknVW2CUz8iBFunft3GYz+eaTDVSxDyx/zDfRjnd2oHlQ5+vI MllKZ5qd/HiJhaR21kt0dPEN8iRuWPlo2RjTbt1oKG1kimx6NJ6ddsuFMQvP1scqYU00 MWcLABKf59JJi3qeuJWzom9GtBpJcg6nF/s0UEYpoHNGWIrmI7Nb1dsN3GgVBPeQsuVH 47TbpkHZ8VqsjtTrubi18EN0fIx81GWY04+GvIQKCK3z5GPvgqhyGCNRtcTS2Pr4y1ha C9ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=m8exilOf; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c26si7518233edx.353.2019.10.06.10.42.16; Sun, 06 Oct 2019 10:42:16 -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=@kernel.org header.s=default header.b=m8exilOf; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731287AbfJFRmP (ORCPT + 27 others); Sun, 6 Oct 2019 13:42:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:41976 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730351AbfJFRmN (ORCPT ); Sun, 6 Oct 2019 13:42:13 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6A28F20700; Sun, 6 Oct 2019 17:42:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570383732; bh=NpxL+WCCtdslumQX2yqO+h1199gm+NJi3hIXzXiutNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m8exilOfkITt/tTO4SX+3VaSXlM9ma/LRoGnor/wB5Ca/qSAqTZuE8YCH0MtWBtiP LbHr0NEujkWmRxtuE2hK3VFueri7StFZMO+GFKvph+J5qT3y8B2Sq07Ydgz6CncgJV xYTynWlGeXXZlsMq6+n+0SP2ZIxFFSF+ooC4I3Ig= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dong Aisheng , Jordan Crouse , Bjorn Andersson , Stephen Boyd , Sasha Levin Subject: [PATCH 5.3 074/166] clk: Make clk_bulk_get_all() return a valid "id" Date: Sun, 6 Oct 2019 19:20:40 +0200 Message-Id: <20191006171219.660307134@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191006171212.850660298@linuxfoundation.org> References: <20191006171212.850660298@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bjorn Andersson [ Upstream commit 7f81c2426587b34bf73e643c1a6d080dfa14cf8a ] The adreno driver expects the "id" field of the returned clk_bulk_data to be filled in with strings from the clock-names property. But due to the use of kmalloc_array() in of_clk_bulk_get_all() it receives a list of bogus pointers instead. Zero-initialize the "id" field and attempt to populate with strings from the clock-names property to resolve both these issues. Fixes: 616e45df7c4a ("clk: add new APIs to operate on all available clocks") Fixes: 8e3e791d20d2 ("drm/msm: Use generic bulk clock function") Cc: Dong Aisheng Cc: Jordan Crouse Signed-off-by: Bjorn Andersson Link: https://lkml.kernel.org/r/20190913024029.2640-1-bjorn.andersson@linaro.org Reviewed-by: Jordan Crouse Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/clk-bulk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c index 524bf9a530985..e9e16425c739c 100644 --- a/drivers/clk/clk-bulk.c +++ b/drivers/clk/clk-bulk.c @@ -18,10 +18,13 @@ static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks, int ret; int i; - for (i = 0; i < num_clks; i++) + for (i = 0; i < num_clks; i++) { + clks[i].id = NULL; clks[i].clk = NULL; + } for (i = 0; i < num_clks; i++) { + of_property_read_string_index(np, "clock-names", i, &clks[i].id); clks[i].clk = of_clk_get(np, i); if (IS_ERR(clks[i].clk)) { ret = PTR_ERR(clks[i].clk);