From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B702C4CECD for ; Tue, 17 Sep 2019 20:39:03 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1ECF22054F for ; Tue, 17 Sep 2019 20:39:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="OSeRIA5Z"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="DqQiSuG8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1ECF22054F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:Subject:From:To: References:In-Reply-To:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=I4IkjU+y1mBP1UNk3QspAd+9OfwFnVwGzOOK5Sqbd0A=; b=OSeRIA5Z3Gqv/c LJGaL63j1o8uaZfdzyPYX9qqLDhHIRQMbRLo4WqYMhovSbMagMEl24POObWfFghFQdgH876xVnIy5 awSOuDbj+Wa0r5Wpvre1FIJuZ2Aiurxt5UbbB3tejDCAacdRrspKG0ABPNz9mJiDJgz44zzg7LPb5 7uuYBqZnkHZDQ+Na1ksKlcZWKVFaXzVZy6ynOXElIeJYvzlkeAL6dtIvqmQSJ7XfeQ6jiDBb75Ayb epMrd8kf6Td8jUd83sFD3jxfFDaxvZ0bCwRIvLTIzJ5bRtUvSf23a1Sa2HV1si31z1cyiBTp+VDAo ds6ep6aXJkmb1Z3l6hrg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iAKFW-0005Bt-0S; Tue, 17 Sep 2019 20:38:58 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iAKFT-0005BA-0a for linux-arm-kernel@lists.infradead.org; Tue, 17 Sep 2019 20:38:56 +0000 Received: from kernel.org (unknown [104.132.0.74]) (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 8CF702054F; Tue, 17 Sep 2019 20:38:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568752734; bh=kVUefUbXR0mBH5Ui5KzFtZDJlyTMzgtjcJqAGMFeGQc=; h=In-Reply-To:References:Cc:To:From:Subject:Date:From; b=DqQiSuG8aBiB88+nJ8OiopeOGKmBr7luh2PMR/vvYacQpSyOGMkttJlq/epSiU9ML Z7kCDaXWsgcZ5v+U/SpGFQgKncN1BZ0e1ajvmg3ZtM5x8dWtKKSlFLDUvhEuHrFMSF 79UguoiFq3rajxJtBDsAZoxbmPHKwTS9xAB/pQms= MIME-Version: 1.0 In-Reply-To: <20190916161447.32715-3-manivannan.sadhasivam@linaro.org> References: <20190916161447.32715-1-manivannan.sadhasivam@linaro.org> <20190916161447.32715-3-manivannan.sadhasivam@linaro.org> To: Manivannan Sadhasivam , mturquette@baylibre.com, robh+dt@kernel.org From: Stephen Boyd Subject: Re: [PATCH v5 2/8] clk: Warn if clk_init_data is not zero initialized User-Agent: alot/0.8.1 Date: Tue, 17 Sep 2019 13:38:53 -0700 Message-Id: <20190917203854.8CF702054F@mail.kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190917_133855_079351_D21701E6 X-CRM114-Status: GOOD ( 14.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Manivannan Sadhasivam , darren.tsao@bitmain.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, fisher.cheng@bitmain.com, alec.lin@bitmain.com, linux-clk@vger.kernel.org, haitao.suo@bitmain.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Quoting Manivannan Sadhasivam (2019-09-16 09:14:41) > 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(+) > > 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)); > + This will warn for many drivers because they set clk_init_data on the stack and assign parent_names but let junk from the stack be assigned to parent_data. The code uses parent_names first and then looks for parent_data or parent_hws because of this fact of life that we've never required clk_init_data to be initialized to all zero. > /* > * Avoid unnecessary string look-ups of clk_core's possible parents by > * having a cache of names/clk_hw pointers to clk_core pointers. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel