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 12CAFC07E9D for ; Tue, 27 Sep 2022 21:39:29 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B8B6184E0D; Tue, 27 Sep 2022 23:38:37 +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="HDxhRehk"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="a3OuxrTQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A9FD184E13; Tue, 27 Sep 2022 23:38:25 +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 417BA84E21 for ; Tue, 27 Sep 2022 23:38:19 +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 075951FA2D; Tue, 27 Sep 2022 21:38:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1664314699; 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=m5zX/C7K4wRuEM9Iv9hSFvHw1koEPIcpIZ8akKx4sfA=; b=HDxhRehkRDb8pNsDv0Vt/5otluW4sMMcZD0YWaRmARqRBWnpOBmCV57vV6BJkMn0mHWBfx mN6PrknGW1QEIHvpyFnQNR44cRatW+LJi9o6Y6BkY/sAwCTTX8/lBu2Pn5ufYSaZnoSgAD IkA3egh/irkkGols9cXlHXZQl4UMMrg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1664314699; 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=m5zX/C7K4wRuEM9Iv9hSFvHw1koEPIcpIZ8akKx4sfA=; b=a3OuxrTQ0KR5ZNee03RI/6HBkD7oQZvahPfYj14SGS3n/MthsyqrVTVKZ/zj6bdjqBtodK S2klal1GVjsAJDBA== Received: from naga.suse.cz (unknown [10.100.224.114]) by relay2.suse.de (Postfix) with ESMTP id CA6CF2C18D; Tue, 27 Sep 2022 21:38:18 +0000 (UTC) From: Michal Suchanek To: u-boot@lists.denx.de Cc: Michal Suchanek , Simon Glass , Jason Liu , Heinrich Schuchardt , Loic Poulain , Bin Meng , Anatolij Gustschin Subject: [PATCH v5 06/15] stdio: Fix class iteration in stdio_add_devices() Date: Tue, 27 Sep 2022 23:37:58 +0200 Message-Id: <8a5ad0e735976d28e92ff6384c04a4ae07c2f60d.1664314043.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 There is a complaint in the code that iterates keyboards that we don't have the _check variant of class iterator but we in fact do, use it. In the code that iterates video devices there is an attempt to print errors but the simple iterator does not return a device when there is an error. Use the _check variant of the iterator as well. Also print the symbolic error. Fixes: b206cd7372 ("dm: stdio: Plumb in the new keyboard uclass") Fixes: e3b81c1c0d ("dm: stdio: video: Plumb the video uclass into stdio") Signed-off-by: Michal Suchanek --- common/stdio.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/common/stdio.c b/common/stdio.c index 92161a0df8..17f0aef76d 100644 --- a/common/stdio.c +++ b/common/stdio.c @@ -306,7 +306,6 @@ int stdio_init_tables(void) int stdio_add_devices(void) { struct udevice *dev; - struct uclass *uc; int ret; if (IS_ENABLED(CONFIG_DM_KEYBOARD)) { @@ -316,24 +315,18 @@ int stdio_add_devices(void) * have a list of input devices to start up in the stdin * environment variable. That work probably makes more sense * when stdio itself is converted to driver model. - * - * TODO(sjg@chromium.org): Convert changing - * uclass_first_device() etc. to return the device even on - * error. Then we could use that here. */ - ret = uclass_get(UCLASS_KEYBOARD, &uc); - if (ret) - return ret; /* * Don't report errors to the caller - assume that they are * non-fatal */ - uclass_foreach_dev(dev, uc) { - ret = device_probe(dev); + for (ret = uclass_first_device_check(UCLASS_KEYBOARD, &dev); + dev; + ret = uclass_next_device_check(&dev)) { if (ret) - printf("Failed to probe keyboard '%s'\n", - dev->name); + printf("%s: Failed to probe keyboard '%s' (ret=%d %s)\n", + __func__, dev->name, ret, errno_str(ret)); } } #if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) @@ -353,13 +346,15 @@ int stdio_add_devices(void) int ret; if (!IS_ENABLED(CONFIG_SYS_CONSOLE_IS_IN_ENV)) { - for (ret = uclass_first_device(UCLASS_VIDEO, &vdev); - vdev; - ret = uclass_next_device(&vdev)) - ; - if (ret) - printf("%s: Video device failed (ret=%d)\n", - __func__, ret); + for (ret = uclass_first_device_check(UCLASS_VIDEO, + &vdev); + vdev; + ret = uclass_next_device_check(&vdev)) { + if (ret) + printf("%s: Failed to probe video device '%s' (ret=%d %s)\n", + __func__, dev->name, + ret, errno_str(ret)); + } } if (IS_ENABLED(CONFIG_SPLASH_SCREEN) && IS_ENABLED(CONFIG_CMD_BMP)) -- 2.37.3