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 B84B4C00528 for ; Sun, 30 Jul 2023 17:15:51 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 07517865DE; Sun, 30 Jul 2023 19:15:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org 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=chromium.org header.i=@chromium.org header.b="Yoe5Osfz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 19C528692D; Sun, 30 Jul 2023 19:15:41 +0200 (CEST) Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) (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 A78E4866DA for ; Sun, 30 Jul 2023 19:15:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2b.google.com with SMTP id ca18e2360f4ac-79095499a17so73785839f.3 for ; Sun, 30 Jul 2023 10:15:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1690737337; x=1691342137; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ClxEvbNbFYO/gh/VF7Am8U1PUp+IIudFO00bw2rH+1U=; b=Yoe5OsfzTtNhbDw1CRCiEUivZODzIexg4eO8odEt3ncbIFHrdN4uHDM/vsyhLP7Fp+ XWY0LaseqaDUZqvazjRB1w4Il9DmxBlQttwtYzQTwTfQFMC+T5KXcrf0BYlEgcil6RE+ jv/8uCaBEHVnvFhWmsn59C3hPciIn3yw1ocp4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690737337; x=1691342137; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ClxEvbNbFYO/gh/VF7Am8U1PUp+IIudFO00bw2rH+1U=; b=jyd/mfHJKtLq5yN0oHqNyg1M2hjhpbR7w1BBdUIcS+OpuvDKdJVGYH+q748lLrItC5 62i7K+34F4NEDjZOujKB9jgdfjD+v7iZCveUii9QOlC6h3gYo1NDCexSbH35r94oRSQH Xxpg2zQzNqIyWElO/uukqfpO9pz1iqFwMSnoo70d07FPQPukBAgpalDBv5YRlMUp2Yaf WmfMh7hKGAY+MtbXGfXEjHWyZ7ka+30qVVHke1FfQvYzA+K/fYMZnK0eT/CivFezmkZ5 bebZVK6qr20T8/Y0c2wub8XEVgOquPK5CAKOAgmObgYnlkYpBmSsvK48XYOrfscS6Ci1 F/pg== X-Gm-Message-State: ABy/qLZ2kQXIIAspu9re2ISLf0abD2prHSce4wsMPBfEQCriiI2nlaXU zP/SFLFhy/m7JC14cKEaXzsaCjNgAhkTdF6J0r4= X-Google-Smtp-Source: APBJJlEk+davRB70Nbr7qlDzmdpEibXVcEuhjlCpWXWmB2N96OPshFiP2qH8AOOQiFgV3/KpK7ifTA== X-Received: by 2002:a5e:d70c:0:b0:790:8665:d9e2 with SMTP id v12-20020a5ed70c000000b007908665d9e2mr6855726iom.19.1690737337159; Sun, 30 Jul 2023 10:15:37 -0700 (PDT) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id y11-20020a6bd80b000000b00786582eb9fbsm2657473iob.15.2023.07.30.10.15.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jul 2023 10:15:36 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Mattijs Korpershoek , Bin Meng , Simon Glass , Fabrice Gasnier , Marek Vasut , Patrice Chotard , Patrick Delaunay Subject: [PATCH v2 2/9] usb: Return -ENOENT when no devices are found Date: Sun, 30 Jul 2023 11:15:12 -0600 Message-ID: <20230730171531.914677-2-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog In-Reply-To: <20230730171531.914677-1-sjg@chromium.org> References: <20230730171531.914677-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean When USB finds no devices it currently returns -EPERM which bootstd does not understand. This causes other bootdevs of the same priority to be skipped. Fix this by returning the correct error code. Signed-off-by: Simon Glass --- (no changes since v1) drivers/usb/host/usb-uclass.c | 2 +- include/usb.h | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c index 02c0138a2065..7a03435ba773 100644 --- a/drivers/usb/host/usb-uclass.c +++ b/drivers/usb/host/usb-uclass.c @@ -346,7 +346,7 @@ int usb_init(void) if (controllers_initialized == 0) printf("No working controllers found\n"); - return usb_started ? 0 : -1; + return usb_started ? 0 : -ENOENT; } int usb_setup_ehci_gadget(struct ehci_ctrl **ctlrp) diff --git a/include/usb.h b/include/usb.h index 42b001c3dd5e..09e3f0cb309c 100644 --- a/include/usb.h +++ b/include/usb.h @@ -257,7 +257,14 @@ int usb_kbd_deregister(int force); #endif /* routines */ -int usb_init(void); /* initialize the USB Controller */ + +/* + * usb_init() - initialize the USB Controllers + * + * Returns: 0 if OK, -ENOENT if there are no USB devices + */ +int usb_init(void); + int usb_stop(void); /* stop the USB Controller */ int usb_detect_change(void); /* detect if a USB device has been (un)plugged */ -- 2.41.0.487.g6d72f3e995-goog