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 Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 19D32C04A95 for ; Sun, 25 Sep 2022 08:32:37 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B842284BFC; Sun, 25 Sep 2022 10:29:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.b="D9doviSK"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="0x4Q2pP7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7A763845C3; Sun, 25 Sep 2022 10:28:54 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 47C5884AEC for ; Sun, 25 Sep 2022 10:28:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=msuchanek@suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 17D4F1FD49; Sun, 25 Sep 2022 08:28:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1664094518; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RrZX11uzbd/KEGv6hf3qc4EQxor79DqJweHJteWWuD8=; b=D9doviSKxUEgceRHVbP39DUM/sgP3PF3XuTtV7OKTAL8LUEoDsYbX5vHYnOMJv0RMrbbMp p3MHIOxeoTKUUF85oUSfuwYokzE0by8viS7eResEb+sjh4dBQlRaB9oR3lHitv0Nv4t96Z NBRkE5VcTTv21bbD1mbQuTMVbDxMRJM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1664094518; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RrZX11uzbd/KEGv6hf3qc4EQxor79DqJweHJteWWuD8=; b=0x4Q2pP7KJSiqt+gx8cfujRFdOKqwrDa+zc80oVfYLX0vofsXo94+nfjuOz3/sA/0UbJwW Ws1V5cx1+Ycm1kBA== Received: from naga.suse.cz (unknown [10.100.224.114]) by relay2.suse.de (Postfix) with ESMTP id DCA772C190; Sun, 25 Sep 2022 08:28:37 +0000 (UTC) From: Michal Suchanek To: u-boot@lists.denx.de Cc: Michal Suchanek , Bin Meng , Simon Glass , Samuel Holland , Andrew Jeffery , Heinrich Schuchardt , Eddie James Subject: [PATCH v4 19/21] dm: treewide: Do not use the return value of simple uclass iterator Date: Sun, 25 Sep 2022 10:28:12 +0200 Message-Id: <864985d3124ce9aa967adbedca1e63498253c2b7.1664093812.git.msuchanek@suse.de> X-Mailer: git-send-email 2.37.3 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.6 at phobos.denx.de X-Virus-Status: Clean uclass_first_device/uclass_next_device return value will be removed, don't use it. Signed-off-by: Michal Suchanek --- cmd/virtio.c | 9 +++------ drivers/gpio/gpio-uclass.c | 14 ++++++-------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/cmd/virtio.c b/cmd/virtio.c index ea3ed2e631..f7a2ef4313 100644 --- a/cmd/virtio.c +++ b/cmd/virtio.c @@ -23,18 +23,15 @@ static int do_virtio(struct cmd_tbl *cmdtp, int flag, int argc, * device_probe() for children (i.e. virtio devices) */ struct udevice *bus, *child; - int ret; - ret = uclass_first_device(UCLASS_VIRTIO, &bus); - if (ret) + uclass_first_device(UCLASS_VIRTIO, &bus); + if (!bus) return CMD_RET_FAILURE; while (bus) { device_foreach_child_probe(child, bus) ; - ret = uclass_next_device(&bus); - if (ret) - break; + uclass_next_device(&bus); } return CMD_RET_SUCCESS; diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index 0ed32b7217..3a35f1e30a 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -59,11 +59,10 @@ static int gpio_to_device(unsigned int gpio, struct gpio_desc *desc) { struct gpio_dev_priv *uc_priv; struct udevice *dev; - int ret; - for (ret = uclass_first_device(UCLASS_GPIO, &dev); + for (uclass_first_device(UCLASS_GPIO, &dev); dev; - ret = uclass_next_device(&dev)) { + uclass_next_device(&dev)) { uc_priv = dev_get_uclass_priv(dev); if (gpio >= uc_priv->gpio_base && gpio < uc_priv->gpio_base + uc_priv->gpio_count) { @@ -73,7 +72,7 @@ static int gpio_to_device(unsigned int gpio, struct gpio_desc *desc) } /* No such GPIO */ - return ret ? ret : -ENOENT; + return -ENOENT; } #if CONFIG_IS_ENABLED(DM_GPIO_LOOKUP_LABEL) @@ -121,12 +120,11 @@ int dm_gpio_lookup_name(const char *name, struct gpio_desc *desc) struct udevice *dev; ulong offset; int numeric; - int ret; numeric = isdigit(*name) ? dectoul(name, NULL) : -1; - for (ret = uclass_first_device(UCLASS_GPIO, &dev); + for (uclass_first_device(UCLASS_GPIO, &dev); dev; - ret = uclass_next_device(&dev)) { + uclass_next_device(&dev)) { int len; uc_priv = dev_get_uclass_priv(dev); @@ -154,7 +152,7 @@ int dm_gpio_lookup_name(const char *name, struct gpio_desc *desc) } if (!dev) - return ret ? ret : -EINVAL; + return -EINVAL; gpio_desc_init(desc, dev, offset); -- 2.37.3