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 12499C04A6A for ; Sun, 13 Aug 2023 14:29:43 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D1164869A3; Sun, 13 Aug 2023 16:27:41 +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="XAxwff0Z"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A6F4D8609B; Sun, 13 Aug 2023 16:27:39 +0200 (CEST) Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) (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 6B0F286963 for ; Sun, 13 Aug 2023 16:27: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=sjg@chromium.org Received: by mail-il1-x132.google.com with SMTP id e9e14a558f8ab-349783c5d43so15923905ab.3 for ; Sun, 13 Aug 2023 07:27:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1691936856; x=1692541656; 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=TXEH0oHK+XxZM1aqBnFD2lDHFNluVH8BCwcSQbyWATc=; b=XAxwff0Z2wUiFf8Ap+EJ4tt9+YX71RmNWtkpA4OUcw42yrN/GRlGwtYVwNwJQRcclT VsORkZgL2hucTjGxOT2xnLa56+Sw6umOQnoldIcTrgTJNPvvwxlTFp67Sc3b77XJqTSh gNF5tUTzfNoqtl0lyHvMTgzJxoRZkn+4gfLOk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691936856; x=1692541656; 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=TXEH0oHK+XxZM1aqBnFD2lDHFNluVH8BCwcSQbyWATc=; b=IEEETkaGim9TYwCx2C+U2UiwTTY0Pu7Q2twWyI7AMavSjsVDTOKMyVrY1WlINH8aqQ s+g8Yx3Dw4qbqsXhRZ9oXhYzu+mCR4l0hQTDijYNDDpAJDuaYxZtSVQgKoOzLB4IuTOr K2dmLQLJkdjGrw5cfBjWzy6VytSnomTWaKTx2/DrtTPZCSBkKbTINaLFpPeFsH9XDd2E m3hdLYxP289Mu1bK2xe358OXdnLc+BM6L9O4XdQPXTM7ajPdPLwXQx01tmpqYXhGGskh HzQo2Tlu6iX+DnCDSYp0rTkwH84rnj92lwCneimHNjfVgWCXz3Ifs+uRbw+1blM3sufM QZoQ== X-Gm-Message-State: AOJu0Yw48AhyPEvdAtFkhUcVpSE/Hcbl5zI5SUQfyE//sZEEt6AfqZ+S DD4+sojanvuTBTCWT03pnHPSq+fG9jiILVtxcBs= X-Google-Smtp-Source: AGHT+IEuclo265q/atwcPiegpDt601spyuAR8i8UGKxcgWoX0K8lmoLLCS8riCWW4Or4aTj8HsD+Jg== X-Received: by 2002:a92:c242:0:b0:349:784:4c40 with SMTP id k2-20020a92c242000000b0034907844c40mr10519246ilo.19.1691936856114; Sun, 13 Aug 2023 07:27:36 -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 w7-20020a02cf87000000b00430cf006d9bsm2280952jar.30.2023.08.13.07.27.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Aug 2023 07:27:35 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Marek Vasut , Pavel Herrmann Subject: [PATCH 13/24] dm: core: Correct error handling when event fails Date: Sun, 13 Aug 2023 08:26:41 -0600 Message-ID: <20230813142708.361456-14-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.640.ga95def55d0-goog In-Reply-To: <20230813142708.361456-1-sjg@chromium.org> References: <20230813142708.361456-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 Follow the correct path in device_probe() when and event handler fails. This avoids getting into a strange state where the device appears to be activated but is not. Signed-off-by: Simon Glass --- drivers/core/device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/core/device.c b/drivers/core/device.c index 6e26b64fb812..60f8d6700ad4 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -598,9 +598,10 @@ int device_probe(struct udevice *dev) ret = device_notify(dev, EVT_DM_POST_PROBE); if (ret) - return ret; + goto fail_event; return 0; +fail_event: fail_uclass: if (device_remove(dev, DM_REMOVE_NORMAL)) { dm_warn("%s: Device '%s' failed to remove on error path\n", -- 2.41.0.640.ga95def55d0-goog