Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp625328lqb; Fri, 24 May 2024 08:25:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUdPULCNhMyME9HOCeNAmgBSMVSiN4YO+lvD8Nb67HaO2MPmHDiQirVDsekjUXvs1O/PONWxEXX5Q8HaBGoh0niBWHD4PzuiHoL/Vxi/w== X-Google-Smtp-Source: AGHT+IHzMasDltGSVm2TIkTQWLQsrHi54OsKLln38y+2d/kTD/XxfksDgpw8RamQUli6EB7PrCuO X-Received: by 2002:a17:906:3744:b0:a59:efd0:e884 with SMTP id a640c23a62f3a-a62646ce058mr192384266b.27.1716564307318; Fri, 24 May 2024 08:25:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716564307; cv=pass; d=google.com; s=arc-20160816; b=mFIJBp2YFfte9aKTP2dvHNQkf30MnAxqyaFkr1I9hhkg1oU2ECy8v1nknDjBaJEl85 4gfT32vennRYnzduqfW/Gmw67A0zgaPbbpzr1cGYBgFlsPcsBaB1+txm0N7/6iBfn43N GBbEHV1ePFAWdaQggAq682hfH9+WVx6ej93eViX3MbcKU7OIMZkVARRhahtO16WJ51qU 8q/PE2enevWj2BwESP5rKBA5cUtGbKDk1wqIqK61oWxR+SpQ8HusiKicm2h+PATLDQVB VkYH8efmTySpedGaRyZ9ftKF9fc06iEJr7rrW/KZgFG8XI0A1TFkU99kvC7vyZ2TSy3m ur7w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=YppIzif2hxqccFPGz5Hh9YVI07X4BAYIHIW3FdSSYI8=; fh=/A1ytk372EO9vjVFfQ+z3rjtrYet+2GTFpXGH/z2XPU=; b=iOLybg8oSfLbW3Wrp0AGhPmj8XKwH7uZGY9FFZaU0vvSdp9qiW2SD1eTrGqs6aeCpt xWbFZL8fOPeIC4520WSHWyGRSmKMIbD/2/UQF8ZQpVp/T1S3YFC83ZOgWeHu2erbkksZ IBUDXS7BK0C92hhQB4dNAvCxlhiodqLxo09Rpsum/q/Eifw/BZGPhycgUZRQOmT0QUMZ pnOxqIQSywhKSw4sVYWRgTKdoQw2bAIO/ZhkO0rKPPNHCxnd4e0PxZlMWWgikLpEZDgm +ePkGTI98eD9R1QmYaPSet/H9AAvPqquZtPahBnaRWqtl1PgatXF+G1eJUEcjclV1xIM 9hXQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=a0sGCF2r; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-188853-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188853-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a626c7ff096si93085966b.55.2024.05.24.08.25.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 08:25:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188853-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=a0sGCF2r; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-188853-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188853-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 12E6C1F21B88 for ; Fri, 24 May 2024 15:25:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D4CF12DD99; Fri, 24 May 2024 15:24:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="a0sGCF2r" Received: from out-182.mta0.migadu.com (out-182.mta0.migadu.com [91.218.175.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 125581802B for ; Fri, 24 May 2024 15:24:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716564298; cv=none; b=NBIYs5SUXd8vQXzG+/NGqUwYQSwU6S/5ZFu8c1JHO/cz3zGpHVeRgmHtAafNxaa6eUGMeRHwVQVyK8NgGvmybygRG9a7Gs9SqWr2Wn+6Was1PKcKNLbmq8sb5foyYW/XtFY7wiz2CDVjlp1TPHHa5+tauPWFGCi7FEOkf00aB7k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716564298; c=relaxed/simple; bh=BeMaca235xewFPAx0PvO35sjrAhkdYkAuY4wkzJRxUs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=YD3Yp8NkJkSytrDEqpkMguNBhdrS62czh0CxdbDYEbDq4UwXKgSPMNMx/iVVvutJXOB2fx8HqaPLfJIFr8b6Om7yoL2LJuuEbz838J8tO/GSCSuOwaLlf/AKftnbW6osEGDLguCog7+TB7xIRA1nAAbLUJIQb5+rT0lgUh+RNJY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=a0sGCF2r; arc=none smtp.client-ip=91.218.175.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: dan.carpenter@linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1716564295; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YppIzif2hxqccFPGz5Hh9YVI07X4BAYIHIW3FdSSYI8=; b=a0sGCF2rK1ld2MDtZzDa0eIKGoJkLuPxHmZEW2SSnIbBPw8eK6JFMoJiX8h6mafiQ/Oflq oKgLX3IlrBobG6P83hn6nuigck86TTtz5nKK1KbcEt4KbQp5BJTZvREzFCHZY6rIQgfBF2 v5zc63X24LZypUwGBDrJdQnrhcQqC8E= X-Envelope-To: lpieralisi@kernel.org X-Envelope-To: kw@linux.com X-Envelope-To: robh@kernel.org X-Envelope-To: linux-pci@vger.kernel.org X-Envelope-To: michal.simek@amd.com X-Envelope-To: thippeswamy.havalige@amd.com X-Envelope-To: linux-arm-kernel@lists.infradead.org X-Envelope-To: bhelgaas@google.com X-Envelope-To: linux-kernel@vger.kernel.org Message-ID: Date: Fri, 24 May 2024 11:24:50 -0400 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v3 6/7] PCI: xilinx-nwl: Add phy support To: Dan Carpenter Cc: Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_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 References: <20240520145402.2526481-1-sean.anderson@linux.dev> <20240520145402.2526481-7-sean.anderson@linux.dev> <41d89132-f6bb-4feb-af1d-412206a85afa@moroto.mountain> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Sean Anderson In-Reply-To: <41d89132-f6bb-4feb-af1d-412206a85afa@moroto.mountain> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 5/24/24 10:59, Dan Carpenter wrote: > 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. Thanks, will fix. --Sean >> + WARN_ON(phy_power_off(pcie->phy[i])); >> + WARN_ON(phy_exit(pcie->phy[i])); >> + } >> + >> + return ret; >> +} > > regards, > dan carpenter >