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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 91983C25B74 for ; Fri, 24 May 2024 14:59:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2tMzJFQjxupzjcwrIhw3aHUpZ6GqysXgGojVZlqOz8I=; b=Txu1uppqeSEg98 0Q18eAMFXTGqE9OOyRkJxLlCwJUVwiyme8QwoRKi0h4oXb+DDS+2NRsh0LBipmMhPpDXbL/yly/bH NxKSKzd/HHhVy8lnKazGpeYGIGR/RgIP+yo+cb4eIg2OdNTDgQ13B4SLKueWkPczqjN3BADK047aV 0RX2a+rfgRmIVWitieuUx4h46lnroQ4PpWioubUbrPOviUC8o0ckGXnSl1eRTOwylKlxcs5xrlG4+ yLkv7sgHakk4lpOMPuXm2I6hkF82XdDBBr+i17luls30+0POr8qXdvWxm23jWzcPrgK8y+gWUJY/K EGGdfGWNEOF32tZ6TtZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sAWO9-00000009Ahc-0V0O; Fri, 24 May 2024 14:59:21 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sAWO7-00000009Ah6-0hlI for linux-arm-kernel@lists.infradead.org; Fri, 24 May 2024 14:59:20 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-420180b58c3so68575265e9.2 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=lists.infradead.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=HTSDJ68Y9ZWU7QnwpZAD1J/Rama5CH3y8EoceB4+xt9r7IW7lWRw6tKtGAifeP/1Lr CSIWfPxna0feNmS6q/fZ8ebpki4V0wSWaRfuvI1EZ1HDbIzYHOP+ohD0TpENiBumjhHS gT4DmOaFpDRsWq/BZxVExLaKV+P2MxQwUcxLoFVj99ku/qy7rBPh4398eXM38PoejD0f Yma7TSahw4ph7OE/qmrGyI85YgCC/8MsyFJtZjj2j3X2gow/rgcVM0zKcyqUEADHSBc2 MT2oWGB2Ul9y/BEoMI5w9X533ob1ULnBZVmAOCoCk3oeHyyeNc0mmJWJ+ziO+/2i7i8m px3g== 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=U2giDNsanx1PKYUTwHXsfHgqsonBLhNOLxJ31QpZ+P/GkuqiGPs4abs5qEzGc0aQ3g XJwJ+BFH3+wliEVkUy5Rhljz9jh76kIgJPpTj4H82yIx0lOJGlYY12D0Er/mcl+xhJwd Q9bLSN8fQEkX1T2gdUdiguEpDzY8iCnK8yQYOmSts7Q+O8Mx7Ftl+Ik9VXOtpz+duKaf 6nI341VX+F4VQarDT+tisM1srHTFuQYvKEWYHnDCiON0Lnoz0WspRuQU5LaQC7dt9W7I vZv1j5LP7tMZZICK/WbSeNoKBNsZwvGyKz+A8dSZ7NBSZx0RNlqG/qAGUKx+cK7QB6sh RT2w== X-Forwarded-Encrypted: i=1; AJvYcCUra8v+OX6vHR5/YNQpiFee97e21JbTirYolv9NP1JIH0XPC9KB+40FWJ+9WLVoG5L6UACl072U3pzVHOGpE/dQjCnFUmTyLxrK+CgHRNwcrPZ5WYI= X-Gm-Message-State: AOJu0YzqOI3Q3i1qCwA2LqvZMet+pAXiZjooZfMgshhtFo4X0yPbOFNm VKqs6k/0Z3/oGVCMkhoL+kVNlfb8joHeK880AJo9g1OpBM2sbeIFf5f6WmAH/M0= X-Google-Smtp-Source: AGHT+IFq0bCDgKuc4UiHOXzKfU6n5S35HgNDJ778we7FOdrAWRUa/2kR7n0rOXH7nejXsAceU6xa9Q== 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> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240520145402.2526481-7-sean.anderson@linux.dev> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240524_075919_241179_7F0AF0A6 X-CRM114-Status: GOOD ( 14.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel