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 F2EA1C25B74 for ; Fri, 24 May 2024 15:25:12 +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:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iXtZ7q31vqCxw/o7C+23MAMuBscfU/E6/btk/pv93Oo=; b=kviu5ktYMuxH7b NAqrBymKUAT3NYYcBiPc6JmUGftWzWRevoXC2HnvCx1jsVbnsMjzSc/ZisVFAYc+MPGh4YzZKHQWb QgfSWJa/pmDzgGd9++wOxtPLYbs+IPQh3qYggvDYgqvFcrOdzHrJ87+5SMb5Pv4dvD78AT+3lmf1p EVZnsTm/UklM5TslQPSn5uieFkwcTcGlOzRmjeGou5KSOi5o9cGa+bqW8ddNO9vz8a1JC3WOaMsWN +nZJ/qXRy6N4ekMUECr8JNwAnoFJ5A1dr4IXXKjKee5GWAJNCSU5HW76pIbPOmQc+6bpsYwjW9mvF BrzIlKvVzFFceqbrB+zw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sAWn0-00000009EM9-0AcT; Fri, 24 May 2024 15:25:02 +0000 Received: from out-176.mta0.migadu.com ([91.218.175.176]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sAWmw-00000009ELU-33Nt for linux-arm-kernel@lists.infradead.org; Fri, 24 May 2024 15:25:00 +0000 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 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> X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240524_082459_250529_10F08319 X-CRM114-Status: GOOD ( 13.49 ) 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 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 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel