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 92FEFC433F5 for ; Thu, 29 Sep 2022 10:03:54 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C81E684D84; Thu, 29 Sep 2022 12:02:37 +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="Pc2tvBv+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7CB5484CE7; Thu, 29 Sep 2022 12:01:16 +0200 (CEST) Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) (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 D0FB484CE7 for ; Thu, 29 Sep 2022 12:01:10 +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@google.com Received: by mail-oi1-x22f.google.com with SMTP id v130so1083675oie.2 for ; Thu, 29 Sep 2022 03:01:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=ix+th8cCFvQG3WOZhyjFe+5+YPQnIYg+1ATIJKcfelk=; b=Pc2tvBv+t1bk9VCg1hROqF8mTlKQ9BHan/8clibA+1xN/ONIyf/HlwyCAjtXcDaKtZ E6KgZ5wxmBH7QhQYeWf3oi83Puao6X7H52ExY54zs10hIhmiCUvD4DcYURfP3zGBmVtK 3PDyeY7A2FUvcoLR2dlYq255sRzP0txOTZJ0Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=ix+th8cCFvQG3WOZhyjFe+5+YPQnIYg+1ATIJKcfelk=; b=n/M3l2GMJrOvEoaE0tfD5iZqAsAM+2KqV9zxXdAGmdrVsaHfjdpn0jhTsbfpdfq4Qa Oja42oQrJhyLrtzd/JiBhOHmbUtSztvJssygmStQNjdvyuEAuJL2YKK9SInm+xv6mQLV XUWlS2kfA97viFDRMq71ObEi6+CZELeea8/jb6uWKlxdKrxhpIxt1hwUdBRm7UP4bhOs WPRwosK9WLlEgEWYZDTylUIh6Xi36FqbLGfvpvXiS/mY+H/bRm1BC7sMGKMRGsQTQV5X NzHWMU6LMT+PqQQiJcyvjwKMWMBlNCqUVKQgAurBJakfkMj2iktyOHtjPSBZ0W+jrNrS e7lA== X-Gm-Message-State: ACrzQf2nbnnVL5DGV0N+8K17UtEwCi1ABMQ+YTg5PD6SD9cKlzif25lT /mOi4yZ/8I7toJ3vEpVntiSl/ltbmqHimbVvF1XGxw== X-Google-Smtp-Source: AMsMyM79LNakIIwR00ItFYX14I295zt4O6UX9baQ0XHqQjEDI+BpshbQvliTmD3i7/53rskv7/R/feQzsgxg+hLz+g0= X-Received: by 2002:a05:6808:f0a:b0:350:61ee:8306 with SMTP id m10-20020a0568080f0a00b0035061ee8306mr6370552oiw.170.1664445670114; Thu, 29 Sep 2022 03:01:10 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Simon Glass Date: Thu, 29 Sep 2022 04:00:50 -0600 Message-ID: Subject: Re: [PATCH v4 20/21] dm: core: Switch uclass_*_device_err to use uclass_*_device_check To: Michal Suchanek Cc: U-Boot Mailing List , Joe Hershberger , Ramon Fried Content-Type: text/plain; charset="UTF-8" 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 Hi Michal, On Sun, 25 Sept 2022 at 02:28, Michal Suchanek wrote: > > The _err variant iterators use the simple iterators without suffix as > basis. > > However, there is no user that uclass_next_device_err for iteration, > many users of uclass_first_device_err use it to get the first and > (assumed) only device of an uclass, and a couple that use > uclass_next_device_err to get the device following a known device in the > uclass list. > > While there are some truly singleton device classes in which more than > one device cannot exist these are quite rare, and most classes can have > multiple devices even if it is not the case on the SoC's EVB. > > In a later patch the simple iterators will be updated to not stop on > error and return next device instead. With this in many cases the code > that expects the first device or an error if it fails to probe may get > the next device instead. Use the _check iterators as the basis of _err > iterators to preserve the old behavior. > > This is problematic for eth_get_dev: it relies on the broken behavior > that returns an error but not the device on which the error happened > which gives the caller no reasonable way to report or handle the error. > With this change the device is returned but eth_get_dev stores the > returned device pointer directly in a global state without checking the > return value. Unset the pointer again in the error case. > > Signed-off-by: Michal Suchanek > --- > drivers/core/uclass.c | 28 ++++++++++++++-------------- > include/dm/uclass.h | 22 +++++++++++----------- > net/eth-uclass.c | 2 ++ Reviewed-by: Simon Glass Better to split out the net: patch. > 3 files changed, 27 insertions(+), 25 deletions(-) > Regards, Simon