From patchwork Wed Jun 24 10:41:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 1316051 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=V2YuF+SL; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49sKV80xfSz9sQt for ; Wed, 24 Jun 2020 20:42:40 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 32F4E82045; Wed, 24 Jun 2020 12:42:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="V2YuF+SL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4527082030; Wed, 24 Jun 2020 12:42:01 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AE49882000 for ; Wed, 24 Jun 2020 12:41:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=seanga2@gmail.com Received: by mail-qk1-x741.google.com with SMTP id e13so1335931qkg.5 for ; Wed, 24 Jun 2020 03:41:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JIS6uhzWl0Tir70I93HTonU68wcpxs43sN0K058lFn8=; b=V2YuF+SLYcf1XvrL9xD2qOOp5O2XApbfijdq+3epsRUOMidc+f1P1ylTtp4viVeBe4 ZfjJ/tVCxaFGakrRzvXt5qWrl1hGr/y/Q86YRktVvy2IRGcFwBwzxccSRja4ETa9mwz0 T68VrtvTnyYfJ9me0QDByN4xo6tfilaqbJ6j+wu7kBQtl80J0eS/WLdRV7WIlom5dZF5 +YRHRDBStP9x4CNnTvMJkuYTuzZEFDuNEOIkpuyBqQJtg2nrzLjIUtBsIVa3w89r2yhF GJJcYMcMI1M9I9jnNd9AwVTCi7ROtln5L09/ciFgK7zXWuq6iH0kqzPThpdiMgVdyD6l PWWg== 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:mime-version:content-transfer-encoding; bh=JIS6uhzWl0Tir70I93HTonU68wcpxs43sN0K058lFn8=; b=Nd1TwMI8gjvOZL1TnoMsIPSztLbUNhVnopxqEI41UXPMDI23TorfGvErt9wu7miadm +nY75DZ3DyQgGTTVxL/WZVVHsqU6wPXbJbtNibo9IDzDSjTSOberUl7UUIu8Y78cuB7n 2k6/Cs9HggtmzFf3FtugqQECh8d6YNXIgdTzvYOxp6ysiHJsge5KNdXn4Rf7gfA3XSnP cn/SBSk5hPoZugBTd7qn+ClBfY3OSLbIjJ8fOVK/wBq79tgHjy3BB82UmhiC+ZrPvH+E 823Qk6EY14e0YrCPvcAc8RTvqelBCGnlq4dgL030G5pKZclUm3uJp6gVI+fDOxc0Jnlw uk+A== X-Gm-Message-State: AOAM531qkGsoUwKHe6uuICQeN8rRkBxFqh38Z0F520AXF0GQ4wvX7Bj0 cg2gCQq6n941BU69k0DXUOLJmxy5j5OB6Q== X-Google-Smtp-Source: ABdhPJw6F5VMojZepn7MyFcJ20RBJREGcvmO9/L4CcGlGhdsT2zInGuNNrZb9CXACJVWFatOb5gZ/w== X-Received: by 2002:a37:448:: with SMTP id 69mr16881494qke.130.1592995313445; Wed, 24 Jun 2020 03:41:53 -0700 (PDT) Received: from godwin.fios-router.home (pool-108-51-35-162.washdc.fios.verizon.net. [108.51.35.162]) by smtp.gmail.com with ESMTPSA id y40sm3438464qtc.29.2020.06.24.03.41.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 03:41:52 -0700 (PDT) From: Sean Anderson To: u-boot@lists.denx.de Cc: Rick Chen , Bin Meng , Sean Anderson , Lukasz Majewski Subject: [PATCH v14 03/20] clk: Fix clk_get_by_* handling of index Date: Wed, 24 Jun 2020 06:41:08 -0400 Message-Id: <20200624104125.363509-4-seanga2@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200624104125.363509-1-seanga2@gmail.com> References: <20200624104125.363509-1-seanga2@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean clk_get_by_index_nodev only ever fetched clock 1, due to passing a boolean predicate instead of the index. Other clk_get_by_* functions got the clock correctly, but passed a predicate instead of the index to clk_get_by_tail. This could lead to confusing error messages. Signed-off-by: Sean Anderson CC: Lukasz Majewski --- Changes in v7: - New drivers/clk/clk-uclass.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index 9ffc2243cb..70df9d410f 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -123,7 +123,7 @@ static int clk_get_by_indexed_prop(struct udevice *dev, const char *prop_name, return clk_get_by_index_tail(ret, dev_ofnode(dev), &args, "clocks", - index > 0, clk); + index, clk); } int clk_get_by_index(struct udevice *dev, int index, struct clk *clk) @@ -135,7 +135,7 @@ int clk_get_by_index(struct udevice *dev, int index, struct clk *clk) index, &args); return clk_get_by_index_tail(ret, dev_ofnode(dev), &args, "clocks", - index > 0, clk); + index, clk); } int clk_get_by_index_nodev(ofnode node, int index, struct clk *clk) @@ -144,10 +144,10 @@ int clk_get_by_index_nodev(ofnode node, int index, struct clk *clk) int ret; ret = ofnode_parse_phandle_with_args(node, "clocks", "#clock-cells", 0, - index > 0, &args); + index, &args); return clk_get_by_index_tail(ret, node, &args, "clocks", - index > 0, clk); + index, clk); } int clk_get_bulk(struct udevice *dev, struct clk_bulk *bulk)