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 59AA9C7EE23 for ; Thu, 1 Jun 2023 16:25:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A7AE38636B; Thu, 1 Jun 2023 18:24:45 +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="CC/K87Au"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 14BAE86354; Thu, 1 Jun 2023 18:24:37 +0200 (CEST) Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) (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 134DB86347 for ; Thu, 1 Jun 2023 18:24:31 +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-x12b.google.com with SMTP id e9e14a558f8ab-33b1da9a8acso4143315ab.3 for ; Thu, 01 Jun 2023 09:24:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1685636670; x=1688228670; 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=VUE4b2cfub6CYabePqkHrY+HhlHmeXntUp9dJwzLpxE=; b=CC/K87AuiatOLf01sXpRL+GaJJ/3rstNdYSXW1iDXF6yPQh2BKRVcaINHN1lNGbWpt 0qHu06vOrawKA3V73gLiUrwoXi4HtEa9Zp5Y8gdySSf/7FsXgPZSrZDZOwlm1z5HPGnQ 5qgi+GyF75StmeSVk1QDCk593lN+cNRE4vHq8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685636670; x=1688228670; 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=VUE4b2cfub6CYabePqkHrY+HhlHmeXntUp9dJwzLpxE=; b=BXN2weZOTT+7P8mZcqTRsgvp7QDGjI2/vYJ794T1qjaau3vdZylxSlKHEhkE6DNjmX 6eD5GuNoKjsR6BeQrFMI/VdvCgiGQGEuOyuwE/5pUaT35BkHViOYaJncucRI1ZZA7pUv YZl2oHV6ajeFZQyOx2WReTYkBBXxKOYGBXK3hR29HuQOtbXj05pXajbLeWgvU/aZd/yJ JeEUbCTTYShmr1ZxRXqHo/Z3RLiRimLxmNY9mSiC5DqR1Vy7JuHPA9pI0wLpwxaV3dBI Hwl2VoGoTtDXajMc638WO7NcZH2N7SAInH1SnrWJe9eAvwBaS+W+N9YZyMgQkQMRAeBX 4ytg== X-Gm-Message-State: AC+VfDxtxsVhwJd3p6KF6l/UOnuIDybdriCrinLNVUB0pt74rWkIuXII tGLXE9PEnAxkT88Fa6McjGunjfwfQptDb7l9to4= X-Google-Smtp-Source: ACHHUZ74RIOAubfFR3aCzugDsZYiWaXtl82xZ2iQw63lIDGbSIdBaSHW3vVxSYq7fIR3OuPx5B+5ew== X-Received: by 2002:a92:db51:0:b0:330:f7b3:ead with SMTP id w17-20020a92db51000000b00330f7b30eadmr6535494ilq.12.1685636670601; Thu, 01 Jun 2023 09:24:30 -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 l1-20020a922901000000b0033a6e7ee4e3sm3862098ilg.1.2023.06.01.09.24.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 09:24:30 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Tom Rini , Simon Glass , Heiko Schocher Subject: [PATCH 06/40] gpio: Avoid using an invalid ofnode Date: Thu, 1 Jun 2023 10:22:30 -0600 Message-ID: <20230601162404.220488-5-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog In-Reply-To: <20230601162404.220488-1-sjg@chromium.org> References: <20230601162404.220488-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 Devices do not necessarily have nodes attached to them, since they can be created from platdata. In SPL a devicetree may in fact not exist at all. Check the node before using it. This avoids failure when OF_CHECKS is enabled. Signed-off-by: Simon Glass Fixes: 5fc7cf8c8e2 ("gpio: add gpio-hog support") --- drivers/gpio/gpio-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index 712119c3415b..31027f3d9902 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -1474,7 +1474,7 @@ static int gpio_post_bind(struct udevice *dev) } #endif - if (CONFIG_IS_ENABLED(GPIO_HOG)) { + if (CONFIG_IS_ENABLED(GPIO_HOG) && dev_has_ofnode(dev)) { struct udevice *child; ofnode node; -- 2.41.0.rc0.172.g3f132b7071-goog