From patchwork Sat Aug 17 18:36:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 171542 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp990306ily; Sat, 17 Aug 2019 11:37:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqyyeGYMKKMc6kh+1HxyOkkyKSebVmgTLDPdXHOcRlFI+WidGg2g4mYewtCZqE83wsXGJx0+ X-Received: by 2002:a62:5207:: with SMTP id g7mr8293910pfb.152.1566067033147; Sat, 17 Aug 2019 11:37:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566067033; cv=none; d=google.com; s=arc-20160816; b=PadtTI97gXG/KZ4EJCTA9MwKZBub3R9XBDsVPlf+Qh/aDta/4PiETxjKT+UqY5Yu8Y psCmPDKyPoOECOsloTUc3SNdkLxsYYhnrwFdtenUk7A7hRDAjt4GulJuoucuhDcXKLIl zVhqe0F4IA55R1t+fQgqFM45ufxR7+bdP3b2THJegKIYt2ptM0WXGQZRV48Q9+uDE0kF X1hHLArglaDupCT1iptl9UA8mOxrfvcVlU0K6J913vKbver5ZY8ZdLpoDMX1kRtPqrqs nyzDYAMD9lsUmy1CF3fT9c0PP6q6g/GM3F7DOJETfPcGTamYTaxo8Ih/FTggjrSmgSfV KV2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=a/DBFL5pnFxmW7r8pfJ654oUFkPKTYmOJJb8EXbuSt0=; b=gN6jkEyd7SFC5qmSitRbjFjETHIOkGVwpBX8P5LHjJDRc+Lc9u3WkXon8KFTZBH/ss PSnhhGycVg7GUcGOBuBF3PbSVdBhJic81GmifEtJu3zxsYB89syCQialK192OhGbzoNt 1a3Qdl6cnOfe4E1kRBDkZIxSsuyc8mXgsJsVp8PqEr512paA9tr3xwyfWWxv+Cw17vkB 25UFqe45HZe+qi+NRftTCInRIVEoClMCngDSlH7oTuzD1WisXlLi224QbGWXQviAkTIh cCR2lMH3uoELBTBkhXWelOuA8w1BMv5LqFuCU0QFjZ35KRMEA/epN3WASZwvVcviQ/aq 1qCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T9fyNuGo; 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 o13si5450685pjt.11.2019.08.17.11.37.12; Sat, 17 Aug 2019 11:37:13 -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=T9fyNuGo; 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 S1726506AbfHQShM (ORCPT + 28 others); Sat, 17 Aug 2019 14:37:12 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:43169 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726481AbfHQShL (ORCPT ); Sat, 17 Aug 2019 14:37:11 -0400 Received: by mail-pf1-f196.google.com with SMTP id v12so4796213pfn.10 for ; Sat, 17 Aug 2019 11:37:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=a/DBFL5pnFxmW7r8pfJ654oUFkPKTYmOJJb8EXbuSt0=; b=T9fyNuGo7nXkSqgRbKRXwczkyhajG9D4rCnAPsUVh/g/paIXjQTwipVm1uF/ABT2V9 cjX/57obkUbaSbUg2sQ8coroy4v0Hgd51SHP8S9tOEXpVOuYbVtzYwtNJlPCnOktQjFf kOVOpXGYlxPLKVxW8k0WsCm0fid2aAyuCeLH4rsHkbgV772Ak58F7M0gCcNFFm5TLEes E5vxEmhWsTueRFidXcLztgrb0kAly+e8Sy/3bFx3pZ/8RWtz+SNR+zbFFMiXAp7QmObT 0cTuFNpdDqLdAseLFnL80NXg7Cx1cbma6cPnuzGALJhT/+zYduRgU3QADv2WfG8bVBaD J5XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=a/DBFL5pnFxmW7r8pfJ654oUFkPKTYmOJJb8EXbuSt0=; b=N+hmGYN9ptFaN/6vNySHzUeLN1/d4Wdd9qKfSJE9FqcjpvHRSLHjs/AlEqavs243Mh jASFdKoWoimoXb8WLTnUFuUJ87k52Rjj1atdVsBBFYG8yE40eZcuNKHHL5Ab0DwjzMaq 7sBeLn0eRe2Lc2AbsCgIAaitBFNUBI2FKmdD8n5tAZtchhOafGljiGxMR1zEI/6Z9aQu poQWwGG5oqPI6uudu0A3zdZRyIpBjU7aoSJG2Pw45XUWcaFxwmoX0eIrhW34VLEF4PJd CUDx4VtTSJpbmQI1D7JLocNqKWUfc4iX/2wiqGP/kTo91eF/3rfe4KftrpYyzv3xMyMw 50/Q== X-Gm-Message-State: APjAAAXVpAat27qvMgVEfDVnP3aE0rDkIR5h25LaQ+KIpmBcR63+QvCW mLzP/CI84pk6wKObvSLDwQ2r X-Received: by 2002:a17:90a:21c1:: with SMTP id q59mr12582966pjc.6.1566067030621; Sat, 17 Aug 2019 11:37:10 -0700 (PDT) Received: from localhost.localdomain ([2409:4072:909:4559:9185:a772:a21d:70ac]) by smtp.gmail.com with ESMTPSA id 33sm8588640pgy.22.2019.08.17.11.37.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Aug 2019 11:37:10 -0700 (PDT) From: Manivannan Sadhasivam To: sboyd@kernel.org, mturquette@baylibre.com, robh+dt@kernel.org Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, haitao.suo@bitmain.com, darren.tsao@bitmain.com, fisher.cheng@bitmain.com, alec.lin@bitmain.com, Manivannan Sadhasivam Subject: [PATCH v2 6/7] clk: Warn if clk_init_data is not zero initialized Date: Sun, 18 Aug 2019 00:06:13 +0530 Message-Id: <20190817183614.8429-7-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190817183614.8429-1-manivannan.sadhasivam@linaro.org> References: <20190817183614.8429-1-manivannan.sadhasivam@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The new implementation for determining parent map uses multiple ways to pass parent info. The order in which it gets processed depends on the first available member. Hence, it is necessary to zero init the clk_init_data struct so that the expected member gets processed correctly. So, add a warning if multiple clk_init_data members are available during clk registration. Signed-off-by: Manivannan Sadhasivam --- drivers/clk/clk.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.17.1 diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index c0990703ce54..7d6d6984c979 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -3497,6 +3497,14 @@ static int clk_core_populate_parent_map(struct clk_core *core) if (!num_parents) return 0; + /* + * Check for non-zero initialized clk_init_data struct. This is + * required because, we only require one of the (parent_names/ + * parent_data/parent_hws) to be set at a time. Otherwise, the + * current code would use first available member. + */ + WARN_ON((parent_names && parent_data) || (parent_names && parent_hws)); + /* * Avoid unnecessary string look-ups of clk_core's possible parents by * having a cache of names/clk_hw pointers to clk_core pointers.