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 90CD0C433EF for ; Fri, 4 Mar 2022 15:43:49 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9F08A83B6B; Fri, 4 Mar 2022 16:43:32 +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="VGQ1seLV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A405D83108; Fri, 4 Mar 2022 16:43:29 +0100 (CET) Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) (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 8BAE3838BF for ; Fri, 4 Mar 2022 16:43:23 +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-xd2e.google.com with SMTP id c18so9955018ioc.6 for ; Fri, 04 Mar 2022 07:43:23 -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=P1hr+vxWfjYBwW0XE5casUylq9o5eieDMyerZVAvzCE=; b=VGQ1seLVzAaB17n6UJLtIxfvKNAiLEUXBv/rKpXjRbr8GAc+v45kBEboavXeWg1xYw T35ddle8msybNAFG+TmD8mBJzfus1dTa1zVl7mccJjHnq5+E3238+2SNCDAPHE5gc89g DEqN5YcfPfwnkUH08LMNIIsC8wbzIEfQRDPLs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=P1hr+vxWfjYBwW0XE5casUylq9o5eieDMyerZVAvzCE=; b=Vma0tHKAtly9Ncm3WXCKPKyRtO4mY/UxUXxmSL4dPtyG9J8zWjlPLWRaSA8v77JwPB vmmDfGqBXlllHGwUgKjVZ7nUn3TOojAqvpnQ2mauk20usoaOWb8p/j7R1AqRh3R2ErFH 9iHSM4YzAgBViFIq90LS6Zxz3xTLeBuNwOnKMmCCMPtVw6dpKQ7wG0yytsPYK/X2tbqe cPx4pBjmEmbpFSwjyRjCjjMZeNAMOswzoOSrBWJb0N5X+T0dNGDIt7/JG0VukE4V2uwI Qqe/3GtufR0eCUs+UJvfd4zp4UDOlgCNl6+lwovYJTMXZbZYuyWyfQfnZIRGqi/ku46g 9BNw== X-Gm-Message-State: AOAM532krGjjQgbjXMzVZ2nTtd+HHit49iNoTBKNczExy+Yr3veW4GIW hwdD81E5zdNYW5Db9U9V/aMeZrZMOl6w8w== X-Google-Smtp-Source: ABdhPJz91gNDGxO+hVlrzhnLyoIIJWfUMvuriXwix2PQVas85mPkK7T1qMAW4I+Cm7r9x575xU4xoQ== X-Received: by 2002:a05:6638:4805:b0:317:3f96:600 with SMTP id cp5-20020a056638480500b003173f960600mr18050481jab.311.1646408602182; Fri, 04 Mar 2022 07:43:22 -0800 (PST) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id h13-20020a5ecb4d000000b006410cd7bf4asm4758814iok.9.2022.03.04.07.43.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 07:43:21 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Marek Vasut , Masahiro Yamada , Tom Rini , AKASHI Takahiro , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Heinrich Schuchardt , Tim Harvey , Adam Ford , Simon Glass , Joe Hershberger Subject: [PATCH v2 01/13] phy: nop-phy: Fix phy reset if no reset-gpio defined Date: Fri, 4 Mar 2022 08:42:56 -0700 Message-Id: <20220304154308.2547711-2-sjg@chromium.org> X-Mailer: git-send-email 2.35.1.616.g0bdcbb4464-goog In-Reply-To: <20220304154308.2547711-1-sjg@chromium.org> References: <20220304154308.2547711-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.5 at phobos.denx.de X-Virus-Status: Clean From: Tim Harvey Ensure there is a valid reset-gpio defined before using it. Fixes: f9852acdce02 ("phy: nop-phy: Fix enabling reset") Cc: Adam Ford Signed-off-by: Tim Harvey Signed-off-by: Simon Glass --- (no changes since v1) drivers/phy/nop-phy.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/phy/nop-phy.c b/drivers/phy/nop-phy.c index e2ee6e9206..d0904f4f07 100644 --- a/drivers/phy/nop-phy.c +++ b/drivers/phy/nop-phy.c @@ -45,11 +45,13 @@ static int nop_phy_init(struct phy *phy) #if CONFIG_IS_ENABLED(DM_GPIO) /* Take phy out of reset */ - ret = dm_gpio_set_value(&priv->reset_gpio, false); - if (ret) { - if (CONFIG_IS_ENABLED(CLK)) - clk_disable_bulk(&priv->bulk); - return ret; + if (dm_gpio_is_valid(&priv->reset_gpio)) { + ret = dm_gpio_set_value(&priv->reset_gpio, false); + if (ret) { + if (CONFIG_IS_ENABLED(CLK)) + clk_disable_bulk(&priv->bulk); + return ret; + } } #endif return 0; -- 2.35.1.616.g0bdcbb4464-goog