From patchwork Mon Sep 11 12:53:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 13379283 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 AB730EEB57D for ; Mon, 11 Sep 2023 12:54:52 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mexzhYanHemr+6TCyJQw9Z/gkHqJvOL/WcNGnYdzm5s=; b=nkOD355Ph6ZCPQ OWDh7GopxNKSb7uS4PS0oY3pGmszz+gdrTHp1qUw9t0d639IgkZpqyPVH0c0RgMxv6YpUWElHM97P 5i60dQFtONGiQBWFKEIWNhMWnBVrFNh9PWWQOISxj1Hup02J7GxmWmKDMPvwdHnk2KgPj2VS1QXHj HpfX8bLoqb0xg5aSkzb1yWUEol/rPGq7+kWAytpPM+tUdnh/R7FpH/IfI3P35j57KSnp9+u4fSdml 6VBxvf7a2P/g1th/y550UGsho6fjR6mWSUd4rFOre63NsWniIy9iG8FBGbGFAdXIpSr/MCP1Ix5cJ oFck86Rs0fngAUdnxfMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfgQs-000WXq-1C; Mon, 11 Sep 2023 12:54:26 +0000 Received: from mgamail.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qfgQn-000WWR-0E for linux-arm-kernel@lists.infradead.org; Mon, 11 Sep 2023 12:54:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694436861; x=1725972861; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EIzH6I89fHcXXY3uRmCZDeB2Y9jdsZHRRgZCynpqYTM=; b=YkeeG00hR86tajEH9gBrKrlo2+nKBxyCh49h3dY9dK77l1NH7tBWkUdB 6bN/qLShbRwcvv3PwPVrAOQGAmXJfSUwDiu4jqll1+w/wnTGVVHm6oz5m cMGt93FjhP2KouA9HaK7W74cLb/2Ku59CJEv8C1M56dQy4ny8K+jqRt5I GCNb12KMmAR6S3Wbz7H9mfOHV3532ryhmzdkrZT1KwR1oda+v4c8kQNS+ dvEJS7elxGobJXk1USRdxDqXbFoMZ8hthbBdnmqleTiXPsDPLETczfHlb ovFRiwtVbFgTBzLTYoG10d25nLh9ZqGQx/c/oLqHZy2SSCNajDfy4Tg7z Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="357511183" X-IronPort-AV: E=Sophos;i="6.02,244,1688454000"; d="scan'208";a="357511183" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2023 05:54:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="858304167" X-IronPort-AV: E=Sophos;i="6.02,244,1688454000"; d="scan'208";a="858304167" Received: from mzarkov-mobl3.ger.corp.intel.com (HELO ijarvine-mobl2.ger.corp.intel.com) ([10.252.36.200]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2023 05:54:10 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: Rob Herring , Bjorn Helgaas , linux-pci@vger.kernel.org, Richard Henderson , Ivan Kokshaysky , Matt Turner , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org Cc: 3chas3@gmail.com, brking@us.ibm.com, dalias@libc.org, glaubitz@physik.fu-berlin.de, jejb@linux.ibm.com, kw@linux.com, linux-arm-kernel@lists.infradead.org, linux-atm-general@lists.sourceforge.net, linux-scsi@vger.kernel.org, linux-sh@vger.kernel.org, lpieralisi@kernel.org, martin.petersen@oracle.com, netdev@vger.kernel.org, toan@os.amperecomputing.com, ysato@users.sourceforge.jp, =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH v3 1/6] alpha: Streamline convoluted PCI error handling Date: Mon, 11 Sep 2023 15:53:49 +0300 Message-Id: <20230911125354.25501-2-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230911125354.25501-1-ilpo.jarvinen@linux.intel.com> References: <20230911125354.25501-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230911_055421_166441_49C4952B X-CRM114-Status: GOOD ( 12.57 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org miata_map_irq() handles PCI device and read config related errors in a conditional block that is more complex than necessary. Streamline the code flow and error handling. No functional changes intended. Signed-off-by: Ilpo Järvinen --- arch/alpha/kernel/sys_miata.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/arch/alpha/kernel/sys_miata.c b/arch/alpha/kernel/sys_miata.c index e1bee8f84c58..33b2798de8fc 100644 --- a/arch/alpha/kernel/sys_miata.c +++ b/arch/alpha/kernel/sys_miata.c @@ -183,16 +183,17 @@ miata_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) the 2nd 8259 controller. So we have to check for it first. */ if((slot == 7) && (PCI_FUNC(dev->devfn) == 3)) { - u8 irq=0; struct pci_dev *pdev = pci_get_slot(dev->bus, dev->devfn & ~7); - if(pdev == NULL || pci_read_config_byte(pdev, 0x40,&irq) != PCIBIOS_SUCCESSFUL) { - pci_dev_put(pdev); + u8 irq = 0; + int ret; + + if (!pdev) return -1; - } - else { - pci_dev_put(pdev); - return irq; - } + + ret = pci_read_config_byte(pdev, 0x40, &irq); + pci_dev_put(pdev); + + return ret == PCIBIOS_SUCCESSFUL ? irq : -1; } return COMMON_TABLE_LOOKUP;