Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp605294lqb; Fri, 24 May 2024 07:59:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUNdvR3JfDmzqZzjwcwBHz6j/H7aQMALhpSppm5t9lj9ypnDjcjdeWSaLOfP5LCx8L6y5/sMskR30Gam0kp0l+AIGBm1USOWiiHfQ4+aQ== X-Google-Smtp-Source: AGHT+IGu2l+nYyBy0oraqamenceRBepGG/bM9O/GODi4LzVeQhQbuHAnvKBWsiGSAv8E9+fKT8Ee X-Received: by 2002:a05:6a21:2b0a:b0:1af:acd5:b462 with SMTP id adf61e73a8af0-1b212f3e8edmr2464503637.50.1716562771115; Fri, 24 May 2024 07:59:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716562771; cv=pass; d=google.com; s=arc-20160816; b=Q8A3RO+SaMi/+cqEtH1DZOXy2XRGPsWPKOBpd0rDd2aPWFTHIvIHSBmwWDeCbCEPqR 91kNl9XjA8u0STIG9lILWPeHzA+RO9+S6QXiLO00XFmpvr8REESvB5wF6f/idfFp/2wo TUKafbPwVK5/DuV850JlvxNup2HzA9TVYtg1uwqSzRFQ72RQlQTgGnUcwsnUtU82j+Tt ej4wgJnlDTB6/9wt17PcK4+jql8WGlveovYp4jOnsHlTASWzSIILraEZ+2K3c/2oIp6d iqpDjVzhOkiUNL2CNQOWrdsMWD1Pxpg+wq0mzmC7Xz3mxCD90ibheAiEly59soDpzf43 V4QA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Tk85nCqz8hNY7JRWhz/zThepuy6o3cVjI0xiL1VXLX0=; fh=oPyR6SOulVRc1pg1OKT5geI49mroJABit3lrMEibytE=; b=q6jbj8rbMHDBqvSktEXCsxIIMLCHklyi+vzkHscNiaTW0T3Xe6DDeVc9qSOnf8G/X2 hxuxex+ASWuMshh5thisFnAYa4/aFFqcBlFR1bzM6yvj4UU6CurDcE2x0cncB4cVt+iv oqWQcw7/RPznYmu3GJB9hqwxLHl48VwUkBolvsbAsVYMyuI9ITrlVWwGy7IXa1n+6GxS Lw0Vb+UKJPVsPV3IfXPI2r/MxzeOIibORfBVSEMdk5oyvu2T5l66i5WZM+73dJe8DITe 6gSBTxfla4+baNS9OnIHAVOEYvJLCyBZ+TOTLe3dtmCto+IZ1/RQbeHPyBuPnHOJ2hog hVpQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JfCiYQHx; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-188821-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188821-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-68221b73badsi1392065a12.1.2024.05.24.07.59.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 07:59:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188821-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JfCiYQHx; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-188821-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188821-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 6A88FB211C1 for ; Fri, 24 May 2024 14:59:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5656712CD8B; Fri, 24 May 2024 14:59:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="JfCiYQHx" Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 025A012C55D for ; Fri, 24 May 2024 14:59:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716562759; cv=none; b=bjOnCkpiad9x5gWfwkgGAA2ZTw/ZydTSe5hWv6E/siTnYcR9xB6aHZO/mxEhFyDDchja3om3ApqCzOXYpHDoTBVhGfOvrqnaf5rDl2jNupNFek/FBABO50ju5XDQp6m+7ornqXR4Sa3BVu0q2p0YvwItJQd0BqR7ns0bkbfZBno= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716562759; c=relaxed/simple; bh=EtDbG/mTVNJyR2zS1qaWqcywYi1onHVXARebeJcxOWg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SScLi5Dh3W1JEv1RyMUG6qNKGV9Xul8vTkfclePyPcwKqssQXGf/p2hrnFLazZkDgJGNrR6X8O1WdM1v3mMbx7WCKKQocf5l9BBXIesGao49e50PITzs+W86cyoGNU1YOT0VsIIY9K4qbH/GDb1jLlvG67R9Yo23QPIJgXkQk1M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=JfCiYQHx; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4210aa012e5so4899925e9.0 for ; Fri, 24 May 2024 07:59:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716562756; x=1717167556; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Tk85nCqz8hNY7JRWhz/zThepuy6o3cVjI0xiL1VXLX0=; b=JfCiYQHxWpVMHcp2E9u2Of6WkQRbn2754vi6lwTMgmxhdKTlDNeXMw6EKUEbZG0eBd 1ZfMMUEK7CVmCjSm2G1eZMg1LACTA/v7V9WnzY8Ts8K8ep5bE0gdAkrHwaHtUW+quK2c iTYZeQ3NxHC7Dg606jqVe+AeE5IpsXQK3C2m24L5GUj7eWPX2ffqD4XEkI03LU4TPJ6E 7Q7mLxJETqaVix0gsffsYlL+r8dvvHugHMscnDafIqIIcTVkp9QwGeVAUde29Br1T7dY fg2k03YHdTYk1gGaAXbmnqW9tbpMl2hV+YNb0PUUapollPfikXolu+MF155k2wel66iz HFEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716562756; x=1717167556; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Tk85nCqz8hNY7JRWhz/zThepuy6o3cVjI0xiL1VXLX0=; b=F2jyWPnxHUa0udM0pybzxuNG2jBCaWppDq0oS4St4J5EaMsyjDBG7b27UcKefP5vV0 0ufG8A/rgYmQEo7skApfSZs0azfTfdpQICg/XvshSTlrknX3E7il1loHaCnhxroh/4IK 8dzo3D/hJ6AvqOdSh8UBRCVDFWRsy8D/PBkpcfj2Ew5IYk+pufnOt/69G04gpAd9O2GB LjuaqRovWHJn5SIkRY3Mk07aw2C3of57Q0Klv+wOPUVLryIrazDWawIcTdHcAicPJTe0 cvW9KRzeEiKuFr+TPBpxuNM8Wzr0UPlShkuN8TAfA9IVkWMK2Oj3CSVr9q3B0hBqP1IO jbtQ== X-Forwarded-Encrypted: i=1; AJvYcCUyqs3zepVK54GYSwVXKixtu2qNWKi1Ad/Hwqf6N8HD8bRXUOfMek4Ulxl6O8+uKaZ/KDysSiXr99NQ34+/K1W0OyZEieKn4qUzNch+ X-Gm-Message-State: AOJu0Yzgr+Zq9nEvI9Lm1LLsPV2iZdh6f1iroaEzLOCoh6qJ1Yv8SMWw TfWfPRB7yWYaqgRPSdVKZWhRiptJtaWvUnvUyW7vgQPK+01BXBNa8xwHXXGXga4= X-Received: by 2002:a05:600c:68c3:b0:420:ef93:cd2f with SMTP id 5b1f17b1804b1-42108a79cdfmr16925355e9.21.1716562756144; Fri, 24 May 2024 07:59:16 -0700 (PDT) Received: from localhost ([102.222.70.76]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42108970b4esm22917645e9.14.2024.05.24.07.59.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 07:59:15 -0700 (PDT) Date: Fri, 24 May 2024 17:59:12 +0300 From: Dan Carpenter To: Sean Anderson Cc: Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , linux-pci@vger.kernel.org, Michal Simek , Thippeswamy Havalige , linux-arm-kernel@lists.infradead.org, Bjorn Helgaas , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 6/7] PCI: xilinx-nwl: Add phy support Message-ID: <41d89132-f6bb-4feb-af1d-412206a85afa@moroto.mountain> References: <20240520145402.2526481-1-sean.anderson@linux.dev> <20240520145402.2526481-7-sean.anderson@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240520145402.2526481-7-sean.anderson@linux.dev> On Mon, May 20, 2024 at 10:54:01AM -0400, Sean Anderson wrote: > +static int nwl_pcie_phy_enable(struct nwl_pcie *pcie) > +{ > + int i, ret; > + > + for (i = 0; i < ARRAY_SIZE(pcie->phy); i++) { > + ret = phy_init(pcie->phy[i]); > + if (ret) > + goto err; > + > + ret = phy_power_on(pcie->phy[i]); > + if (ret) { > + WARN_ON(phy_exit(pcie->phy[i])); > + goto err; > + } > + } > + > + return 0; > + > +err: > + while (--i) { This doesn't work. If we fail on the first iteration, then it will lead to an array underflow. It should be while (--i >= 0) or while (i--). I prefer the first, but the second format works for people who use unsigned iterators. > + WARN_ON(phy_power_off(pcie->phy[i])); > + WARN_ON(phy_exit(pcie->phy[i])); > + } > + > + return ret; > +} regards, dan carpenter