From patchwork Mon Feb 8 04:17:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1437451 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=Wsu6cd4l; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DYt9F5Rvkz9sVJ for ; Mon, 8 Feb 2021 15:20:17 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C798882870; Mon, 8 Feb 2021 05:18:57 +0100 (CET) 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="Wsu6cd4l"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1DEF58286B; Mon, 8 Feb 2021 05:18:27 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 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 8E6FF8284C for ; Mon, 8 Feb 2021 05:18:22 +0100 (CET) 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 f20so77649ioo.10 for ; Sun, 07 Feb 2021 20:18:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tCgicPUMLi4CP0Q8quNw4kXCaR3Uax5H8sUCH7lynhM=; b=Wsu6cd4lGpHpmSBBKJHUcyFRvi2cmergksAiUyLS0SPzfZzCB0OkA1Z7dVBCrYhXTb EhZJsmb/fYGYVcu9Pgv79+sjEJHlF3N68Cemw61UjykWq8KpooZ1T3qa4XYxVJItonz3 Jq78upPNS9r25d5tFwrwWjuF1X8BR7kImojPc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tCgicPUMLi4CP0Q8quNw4kXCaR3Uax5H8sUCH7lynhM=; b=FgGnTMjT/yuRdBaoezSsiy2vbTJFNHKK6/3FJqL3M7MVKp09wjKYCXHU+n9ATg3pfC OtWrGPVFgFhC8Fwo+HBmXiNud74V7xqvRpwUiPcmrPiy7iQ+w/kFxJA1c9HARo801XK1 8LZAuyt3FwDwC91S+61ERZ8hlLkmGQ3qz4ppbZXP0VMRmPreKxufNuIB3OOSy8BD2iiR w8hEsW8ZOhYz6ikS6QNvJ6ORL6MUDhZ/yNhKjhtaF1kXd4wgbbzN9iCcu5Qai/L/EqQo sHABtN4Lu4ImhSReyPaab4Et/pt/cTjnVtKgWu72dokc22TG3z0vOy6S0JNNswLoBT5t c7xQ== X-Gm-Message-State: AOAM533qahZeavJoX+rtstwRZBnqnQJ9k2+ds3L3jPV5+blLwASpMHGt fJfKUoD2VkIHHrycKMTFeAbuJw5MTGTMDYIr X-Google-Smtp-Source: ABdhPJwirdyG2T3ZZx48+12SvTgtOOsMEvWzk5OfzTZoSdOuW5b2t0eliusvOIiCjW7MpqTHWgMHQw== X-Received: by 2002:a02:a90a:: with SMTP id n10mr16279658jam.7.1612757901281; Sun, 07 Feb 2021 20:18:21 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id h10sm8214994ils.10.2021.02.07.20.18.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Feb 2021 20:18:20 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Heinrich Schuchardt , Marek Vasut , Walter Lozano , Bin Meng , Bernhard Messerklinger , Simon Glass , Pavel Herrmann Subject: [PATCH v3 08/42] dm: core: Skip adding uclasses with OF_PLATDATA_INST Date: Sun, 7 Feb 2021 21:17:33 -0700 Message-Id: <20210207211727.v3.8.Icde748d3063580acf92b185f675701c077b72ba8@changeid> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog In-Reply-To: <20210208041807.4079084-1-sjg@chromium.org> References: <20210208041807.4079084-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean There is no need to ever add new uclasses since these are set up at build time. Update the code to return an error if this is attempted. Signed-off-by: Simon Glass --- (no changes since v1) drivers/core/uclass.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index f38122d54b5..2a7b0881b18 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -147,8 +147,11 @@ int uclass_get(enum uclass_id id, struct uclass **ucp) *ucp = NULL; uc = uclass_find(id); - if (!uc) + if (!uc) { + if (CONFIG_IS_ENABLED(OF_PLATDATA_INST)) + return -ENOENT; return uclass_add(id, ucp); + } *ucp = uc; return 0;