From patchwork Mon Sep 16 16:14:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 173866 Delivered-To: patch@linaro.org Received: by 2002:ac9:19ad:0:0:0:0:0 with SMTP id d45csp4090611oce; Mon, 16 Sep 2019 09:15:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqziscmmD6iWTQD0ZY1vCx0/UOorKv3rI6dP1/KJDo9O/PRvYVP3QacaQD9R8fNtfNPM4ImP X-Received: by 2002:a50:e886:: with SMTP id f6mr52990edn.199.1568650513662; Mon, 16 Sep 2019 09:15:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568650513; cv=none; d=google.com; s=arc-20160816; b=Ew0GXYuQKWq5GnV20XWMh/psYOuI89TBEHi0IKt00tKuV/TZGOfyIRlo9HD2DAEYSq eZGbKqxWwTvQcKL+4F+2lAQl+2f1kttM8t1vCN1CdrD0gvFYwQtuMqgiuebCgnMcs4Dd T335vKpUAkCWbKE5dg60ZrTxb8IkczePz8NltTcEIxVhySxcDt7aP+G8VBsfk+K3byFf qVWFdwA2rNCLq77rRsv7EughE4HliSksiGA9EvK+/c7h8mTefRZozkD6ge/MwKWKLvq2 LRsrOR8bCrjByrpQwydh8r+60dFLtMmNSuiQ6hblyb6UJXFYgOe8zoPyHPzGY4bdW7GD WC6A== 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=sFGQa3N8Gw/yLhsRzKeIVfaIt2OKAe4TmjyGXcl14jnSHUCc8zK3cjUf5zEc79GsVR 6XTw+Xv3RVe0ulw0E+Qw3Q1fgVpytRB+2/MNO9DAfE/uD4KLhHZuxzK6FJJpb9NoTUNE 01wU6BsPV1xLa0Nca428l/m4xnaj5y55apXjBFFhK83Qep+ocj+f1CJ+jTXy142JhHjF uL52knsvFIma51hZHdR7oPwo0iD0I2LrJy33G5PRb3amNzyB6DVMc5KS5lQ/z2DRpmqE 4istY4NATLuOuwOuwWGwhXrvgrVQ9UQEw/Zshf7HG8HdNwv4+qTtigH+k4YBS0LytjAY fDtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sYJTtMza; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 k14si20117734ejg.91.2019.09.16.09.15.13; Mon, 16 Sep 2019 09:15:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-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=sYJTtMza; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 S2389780AbfIPQPM (ORCPT + 8 others); Mon, 16 Sep 2019 12:15:12 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:37207 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389705AbfIPQPL (ORCPT ); Mon, 16 Sep 2019 12:15:11 -0400 Received: by mail-pl1-f196.google.com with SMTP id b10so107484plr.4 for ; Mon, 16 Sep 2019 09:15: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=sYJTtMzaFQwnHrfE0d9bJhN5rJL+SO2sue5FpfF9LXaYmhdpitHfR1Mc6XMxU1Oth+ JQAA2gJlVkMivG0TmPvinQOqimNim8N/21fhacTw0RdNDLtxPidi7L9R2U43pM6SLVaQ ua24bR6jkaW/OpEH84OUVaTt5s3KO3zFAZPV1earH/37b07DVZ/iKbah7H78F9ruW6dn BckDQs5uhXLjdbUq/WfcMG7QausOcDfiKMi/tFmNhYQCx/ddbG/CDzBXCEc2cH0dGrc5 KFx+mQF1bn5iJK9R3+e439dl8iIWf/BRAUXaj7JeJ9DvsUXa1qV0jRfO6F4Q3IyBRncZ dtLQ== 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=rIJVoyurbocwt5faFMzHk4nfziRJnNdw/B15KYHt0XdPiAm7dzZe8Ant8AOG6PXcez flo1iq/LXYyscRoIUOYJAZeLYEB7RgK1eyNOlGzD2vTMqHuxAyT6DyrAMiXyqyuL2Jak nORGQx/Flc9TDfhiUa8JsiXE7V4Qeyo3XShl2yRdtsKvseD2/KiixMGZlXF3v14heezi tIRbxg2aUMfFNXRLi4zzmLdRrHlJLDFCiKJKgXedNIHvBwZJDwbBXYH2rb8VOVcakWhQ kKJE/bh3cGVEamtJJs45ZXBWgdEqTGyxRdKL8MVaRffha2WG1c0IFstDKHRsJMQU7g21 O/EQ== X-Gm-Message-State: APjAAAVxsBRw+8kk21IqkVMMYa7XmQc+KYVAe9DPP6N0iA6wZG5Z85eO EWGivSZAbyLYIRfExSe1OhHF X-Received: by 2002:a17:902:7296:: with SMTP id d22mr607247pll.41.1568650510819; Mon, 16 Sep 2019 09:15:10 -0700 (PDT) Received: from localhost.localdomain ([2409:4072:90b:91ce:94c2:ef93:5bd:cfe8]) by smtp.gmail.com with ESMTPSA id h66sm614134pjb.0.2019.09.16.09.15.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 09:15: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 v5 2/8] clk: Warn if clk_init_data is not zero initialized Date: Mon, 16 Sep 2019 21:44:41 +0530 Message-Id: <20190916161447.32715-3-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190916161447.32715-1-manivannan.sadhasivam@linaro.org> References: <20190916161447.32715-1-manivannan.sadhasivam@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@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.