From patchwork Sun Mar 13 19:29:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 12779459 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CD03C433EF for ; Sun, 13 Mar 2022 19:29:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234615AbiCMTaz (ORCPT ); Sun, 13 Mar 2022 15:30:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234636AbiCMTay (ORCPT ); Sun, 13 Mar 2022 15:30:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A9124D604 for ; Sun, 13 Mar 2022 12:29:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A4700B80CF7 for ; Sun, 13 Mar 2022 19:29:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1B4EC340E8; Sun, 13 Mar 2022 19:29:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647199782; bh=lv9D7iOfXA5PjIaE9GIPweH1eI+y/6YiF76CcxBT0aM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I7nYBNsTx/xRrz0n6nuMuePrmNwICu/jUCHJ3GyjeLrZ79Bdfl29WEqXkvAGgY6m/ VWRjmFxcJycOlyO+u1oxSib5yeJhe8weveGajt4ONFQsbxSWfXbgFJN7iMDUizogmx T3VBkuSXxm6u8G3U0xGt7fREvEnl4+xn+Na0+dIxOXL9x8oU24Wt1xG55Bz4tdQMFs XNcc+vyjAckB8H1j4ROvSOne5UJpi8EG2DncqLI+D9vc51rrMv4syxsOvd2f3mgMPM Pn6X3ScKaod/O+InbiH8UPHCC6Noo5klUXVsbZlHFBiCSqDGsTT+l0dzKHtGTco4R0 W+OX+HtmJDOVQ== From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Paul Walmsley , Greentime Hu , Lorenzo Pieralisi , Rob Herring , Xiaowei Song , Binghui Wang , Bjorn Helgaas Subject: [PATCH 1/5] PCI: Remove unused assignments Date: Sun, 13 Mar 2022 14:29:29 -0500 Message-Id: <20220313192933.434746-2-helgaas@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220313192933.434746-1-helgaas@kernel.org> References: <20220313192933.434746-1-helgaas@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Bjorn Helgaas Remove variables and assignments that are never used. Found by Krzysztof Wilczyński using cppcheck, e.g., $ cppcheck --enable=all --force uselessAssignmentPtrArg drivers/pci/proc.c:102 Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? unreadVariable drivers/pci/setup-bus.c:1528 Variable 'old_flags' is assigned a value that is never used. Signed-off-by: Bjorn Helgaas --- drivers/pci/pci-sysfs.c | 7 +------ drivers/pci/proc.c | 4 ---- drivers/pci/setup-bus.c | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 602f0fb0b007..c263ffc5884a 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -754,8 +754,6 @@ static ssize_t pci_read_config(struct file *filp, struct kobject *kobj, u8 val; pci_user_read_config_byte(dev, off, &val); data[off - init_off] = val; - off++; - --size; } pci_config_pm_runtime_put(dev); @@ -818,11 +816,8 @@ static ssize_t pci_write_config(struct file *filp, struct kobject *kobj, size -= 2; } - if (size) { + if (size) pci_user_write_config_byte(dev, off, data[off - init_off]); - off++; - --size; - } pci_config_pm_runtime_put(dev); diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c index 1a5b75399aa5..31b26d8ea6cc 100644 --- a/drivers/pci/proc.c +++ b/drivers/pci/proc.c @@ -99,9 +99,7 @@ static ssize_t proc_bus_pci_read(struct file *file, char __user *buf, unsigned char val; pci_user_read_config_byte(dev, pos, &val); __put_user(val, buf); - buf++; pos++; - cnt--; } pci_config_pm_runtime_put(dev); @@ -176,9 +174,7 @@ static ssize_t proc_bus_pci_write(struct file *file, const char __user *buf, unsigned char val; __get_user(val, buf); pci_user_write_config_byte(dev, pos, val); - buf++; pos++; - cnt--; } pci_config_pm_runtime_put(dev); diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 547396ec50b5..3290b64ea9f0 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -1525,7 +1525,7 @@ static void pci_bridge_release_resources(struct pci_bus *bus, { struct pci_dev *dev = bus->self; struct resource *r; - unsigned int old_flags = 0; + unsigned int old_flags; struct resource *b_res; int idx = 1; From patchwork Sun Mar 13 19:29:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 12779458 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE9EAC433F5 for ; Sun, 13 Mar 2022 19:29:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230155AbiCMTaz (ORCPT ); Sun, 13 Mar 2022 15:30:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234615AbiCMTax (ORCPT ); Sun, 13 Mar 2022 15:30:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C3394D613 for ; Sun, 13 Mar 2022 12:29:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D3B8660A3C for ; Sun, 13 Mar 2022 19:29:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDC91C340E8; Sun, 13 Mar 2022 19:29:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647199784; bh=7KVfacew+6JFbrQM7aODieqhQgGAJ0Y02YuqLB3O03k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VKMEtqAPqSKprpE16hTRIom4sSgMdtUxWhQojKge4shD4kKiI3GB9nWGp9soMIaws Kim29ELluew7dM/kGfMhr7d9DdjwGiq5aXq82PenTXc4wpApc3iWBVCXv0TC/ALYXt EGluQ/23q5w0BosXnRnDUwU1LjHWjObBeqB+N8nVHTS15vmfUNAiHS81HxBXlPC89j wv8yig+2HUHah65cIq7idiG9P7fCUCUApZybW6CjxF+HIS3Scxz7ex8fiEpEv8XvCz AlfDkSBMZf0s++C9VPdu55N965rXSxYtsoU1zxeQ08Q5wAOqB0XUB5VRoZcO0yM3FO FiHXRwdROOiKA== From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Paul Walmsley , Greentime Hu , Lorenzo Pieralisi , Rob Herring , Xiaowei Song , Binghui Wang , Bjorn Helgaas Subject: [PATCH 2/5] PCI: kirin: Remove unused assignments Date: Sun, 13 Mar 2022 14:29:30 -0500 Message-Id: <20220313192933.434746-3-helgaas@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220313192933.434746-1-helgaas@kernel.org> References: <20220313192933.434746-1-helgaas@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Bjorn Helgaas hi3660_pcie_phy_init() assigned "pdev", but never used the value. Drop it. Found by Krzysztof Wilczyński using cppcheck: $ cppcheck --enable=all --force unreadVariable drivers/pci/controller/dwc/pcie-kirin.c:336 Variable 'pdev' is assigned a value that is never used. Signed-off-by: Bjorn Helgaas --- drivers/pci/controller/dwc/pcie-kirin.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c index fa6886d66488..5b56cedebdf1 100644 --- a/drivers/pci/controller/dwc/pcie-kirin.c +++ b/drivers/pci/controller/dwc/pcie-kirin.c @@ -332,9 +332,6 @@ static int hi3660_pcie_phy_init(struct platform_device *pdev, pcie->phy_priv = phy; phy->dev = dev; - /* registers */ - pdev = container_of(dev, struct platform_device, dev); - ret = hi3660_pcie_phy_get_clk(phy); if (ret) return ret; From patchwork Sun Mar 13 19:29:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 12779460 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E015CC433EF for ; Sun, 13 Mar 2022 19:29:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234795AbiCMTa7 (ORCPT ); Sun, 13 Mar 2022 15:30:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234636AbiCMTa6 (ORCPT ); Sun, 13 Mar 2022 15:30:58 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F052F4D274 for ; Sun, 13 Mar 2022 12:29:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 61E4ACE1021 for ; Sun, 13 Mar 2022 19:29:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7AE88C340E8; Sun, 13 Mar 2022 19:29:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647199786; bh=iNcxdOwm0xt6nEOBuxqzmK2AJz/ainD+3ic1m54Aou0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SjF57+XE0LsgSRPhIhq6d9lt8g67ZourEqop+CpfPwT2I4w7DDjwJ47w1lz0K4xLs GLeUlo2KjngAMzdoeE4YNO+afVsuowEtnxFhq4+xoo+IOxhSdhPQStiq5q3GgYORxw VNW2zaNUAVWfr4jKxiNY0jDAf9RgNyTdtiS3LyuoeKr00EAiyKVBpiAHuiIzw2gTGi 50lFeCSLzkx/v+n4TDUI3LSoOa/JdZr1A46p1W5j5ykzb+KIGJ1sDAVYp/anExNlcC RYA/Fgmw3gx42Tl4CNsG3oQia3EmT7a6auOS+WegfxoUm0Z9BXKtRhMHIY2xyFiYoN 9lz+RvROQrjrQ== From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Paul Walmsley , Greentime Hu , Lorenzo Pieralisi , Rob Herring , Xiaowei Song , Binghui Wang , Bjorn Helgaas Subject: [PATCH 3/5] PCI: fu740: Remove unused assignments Date: Sun, 13 Mar 2022 14:29:31 -0500 Message-Id: <20220313192933.434746-4-helgaas@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220313192933.434746-1-helgaas@kernel.org> References: <20220313192933.434746-1-helgaas@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Bjorn Helgaas fu740_pcie_host_init() assigned "ret", but never used the value. Drop it. Found by Krzysztof Wilczyński using cppcheck: $ cppcheck --enable=all --force unreadVariable drivers/pci/controller/dwc/pcie-fu740.c:227 Variable 'ret' is assigned a value that is never used. Signed-off-by: Bjorn Helgaas --- drivers/pci/controller/dwc/pcie-fu740.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-fu740.c b/drivers/pci/controller/dwc/pcie-fu740.c index 00cde9a248b5..43b7b8e18354 100644 --- a/drivers/pci/controller/dwc/pcie-fu740.c +++ b/drivers/pci/controller/dwc/pcie-fu740.c @@ -224,7 +224,7 @@ static int fu740_pcie_host_init(struct pcie_port *pp) /* Clear hold_phy_rst */ writel_relaxed(0x0, afp->mgmt_base + PCIEX8MGMT_APP_HOLD_PHY_RST); /* Enable pcieauxclk */ - ret = clk_prepare_enable(afp->pcie_aux); + clk_prepare_enable(afp->pcie_aux); /* Set RC mode */ writel_relaxed(0x4, afp->mgmt_base + PCIEX8MGMT_DEVICE_TYPE); From patchwork Sun Mar 13 19:29:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 12779461 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A2C0C433F5 for ; Sun, 13 Mar 2022 19:29:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234636AbiCMTbB (ORCPT ); Sun, 13 Mar 2022 15:31:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234908AbiCMTa7 (ORCPT ); Sun, 13 Mar 2022 15:30:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2CDD4D626 for ; Sun, 13 Mar 2022 12:29:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5A43EB80BED for ; Sun, 13 Mar 2022 19:29:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D423BC340E8; Sun, 13 Mar 2022 19:29:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647199789; bh=5O3KYXzBX60H7cr3Po+lUhRk3wfXoGOfIHsQXf/OTnw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rr5cRBKvnXRc3qfpcRUq0y9FHpBGhxyQX0bF/e9WCs6nWztOW+rzZDAs+lrSYsysx k+IEeXdt/yoFDBgLdTv5GH3y6H8mvN5iTN4QvhUV10P8nxPKTxsw3EMsa7CERnwVt5 DXu9zQHB+Eoucyg+vfm3gvE/sMT5Invr2MnQcWkMQSp7ksu2YDrgPYk6GC0BQuFQLA zJW3qDl5NpIJoOJCIkpcJ+Zx7/SFH9Gs3cYHWZcnxSB/Z1T8kHVV8mIcSETfpP1eX7 l93Vd347kCtnAIrQ2OgD1H0a98g7cInvnzj6uDnK2SBEkTwZlzxmsEyDYhwJVWDD8e Z0Bif0Br8jBMA== From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Paul Walmsley , Greentime Hu , Lorenzo Pieralisi , Rob Herring , Xiaowei Song , Binghui Wang , Bjorn Helgaas Subject: [PATCH 4/5] PCI: cpqphp: Remove unused assignments Date: Sun, 13 Mar 2022 14:29:32 -0500 Message-Id: <20220313192933.434746-5-helgaas@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220313192933.434746-1-helgaas@kernel.org> References: <20220313192933.434746-1-helgaas@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Bjorn Helgaas Remove variables and assignments that are never used. Found by Krzysztof Wilczyński using cppcheck, e.g.: $ cppcheck --enable=all --force unreadVariable drivers/pci/hotplug/cpqphp_core.c:1257 Variable 'rc' is assigned a value that is never used. Signed-off-by: Bjorn Helgaas --- drivers/pci/hotplug/cpqphp_core.c | 2 +- drivers/pci/hotplug/cpqphp_ctrl.c | 22 +++++----------------- drivers/pci/hotplug/cpqphp_pci.c | 2 +- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c index f99a7927e5a8..c94b40e64baf 100644 --- a/drivers/pci/hotplug/cpqphp_core.c +++ b/drivers/pci/hotplug/cpqphp_core.c @@ -1254,7 +1254,7 @@ static void __exit unload_cpqphpd(void) struct pci_resource *res; struct pci_resource *tres; - rc = compaq_nvram_store(cpqhp_rom_start); + compaq_nvram_store(cpqhp_rom_start); ctrl = cpqhp_ctrl_list; diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c index 93fd2a621822..e429ecddc8fe 100644 --- a/drivers/pci/hotplug/cpqphp_ctrl.c +++ b/drivers/pci/hotplug/cpqphp_ctrl.c @@ -881,7 +881,6 @@ irqreturn_t cpqhp_ctrl_intr(int IRQ, void *data) u8 reset; u16 misc; u32 Diff; - u32 temp_dword; misc = readw(ctrl->hpc_reg + MISC); @@ -917,7 +916,7 @@ irqreturn_t cpqhp_ctrl_intr(int IRQ, void *data) writel(Diff, ctrl->hpc_reg + INT_INPUT_CLEAR); /* Read it back to clear any posted writes */ - temp_dword = readl(ctrl->hpc_reg + INT_INPUT_CLEAR); + readl(ctrl->hpc_reg + INT_INPUT_CLEAR); if (!Diff) /* Clear all interrupts */ @@ -1412,7 +1411,6 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) u32 rc = 0; struct pci_func *new_slot = NULL; struct pci_bus *bus = ctrl->pci_bus; - struct slot *p_slot; struct resource_lists res_lists; hp_slot = func->device - ctrl->slot_device_offset; @@ -1459,7 +1457,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) if (rc) return rc; - p_slot = cpqhp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); + cpqhp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); /* turn on board and blink green LED */ @@ -1614,7 +1612,6 @@ static u32 remove_board(struct pci_func *func, u32 replace_flag, struct controll u8 device; u8 hp_slot; u8 temp_byte; - u32 rc; struct resource_lists res_lists; struct pci_func *temp_func; @@ -1629,7 +1626,7 @@ static u32 remove_board(struct pci_func *func, u32 replace_flag, struct controll /* When we get here, it is safe to change base address registers. * We will attempt to save the base address register lengths */ if (replace_flag || !ctrl->add_support) - rc = cpqhp_save_base_addr_length(ctrl, func); + cpqhp_save_base_addr_length(ctrl, func); else if (!func->bus_head && !func->mem_head && !func->p_mem_head && !func->io_head) { /* Here we check to see if we've saved any of the board's @@ -1647,7 +1644,7 @@ static u32 remove_board(struct pci_func *func, u32 replace_flag, struct controll } if (!skip) - rc = cpqhp_save_used_resources(ctrl, func); + cpqhp_save_used_resources(ctrl, func); } /* Change status to shutdown */ if (func->is_a_board) @@ -1767,7 +1764,7 @@ void cpqhp_event_stop_thread(void) static void interrupt_event_handler(struct controller *ctrl) { - int loop = 0; + int loop; int change = 1; struct pci_func *func; u8 hp_slot; @@ -1885,7 +1882,6 @@ static void interrupt_event_handler(struct controller *ctrl) void cpqhp_pushbutton_thread(struct timer_list *t) { u8 hp_slot; - u8 device; struct pci_func *func; struct slot *p_slot = from_timer(p_slot, t, task_event); struct controller *ctrl = (struct controller *) p_slot->ctrl; @@ -1893,8 +1889,6 @@ void cpqhp_pushbutton_thread(struct timer_list *t) pushbutton_pending = NULL; hp_slot = p_slot->hp_slot; - device = p_slot->device; - if (is_slot_enabled(ctrl, hp_slot)) { p_slot->state = POWEROFF_STATE; /* power Down board */ @@ -1951,15 +1945,12 @@ int cpqhp_process_SI(struct controller *ctrl, struct pci_func *func) u32 tempdword; int rc; struct slot *p_slot; - int physical_slot = 0; tempdword = 0; device = func->device; hp_slot = device - ctrl->slot_device_offset; p_slot = cpqhp_find_slot(ctrl, device); - if (p_slot) - physical_slot = p_slot->number; /* Check to see if the interlock is closed */ tempdword = readl(ctrl->hpc_reg + INT_INPUT_CLEAR); @@ -2043,13 +2034,10 @@ int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func) unsigned int devfn; struct slot *p_slot; struct pci_bus *pci_bus = ctrl->pci_bus; - int physical_slot = 0; device = func->device; func = cpqhp_slot_find(ctrl->bus, device, index++); p_slot = cpqhp_find_slot(ctrl, device); - if (p_slot) - physical_slot = p_slot->number; /* Make sure there are no video controllers here */ while (func && !rc) { diff --git a/drivers/pci/hotplug/cpqphp_pci.c b/drivers/pci/hotplug/cpqphp_pci.c index 9038039ad6db..3b248426a9f4 100644 --- a/drivers/pci/hotplug/cpqphp_pci.c +++ b/drivers/pci/hotplug/cpqphp_pci.c @@ -473,7 +473,7 @@ int cpqhp_save_slot_config(struct controller *ctrl, struct pci_func *new_slot) int sub_bus; int max_functions; int function = 0; - int cloop = 0; + int cloop; int stop_it; ID = 0xFFFFFFFF; From patchwork Sun Mar 13 19:29:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 12779462 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59F19C433EF for ; Sun, 13 Mar 2022 19:29:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234908AbiCMTbC (ORCPT ); Sun, 13 Mar 2022 15:31:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234923AbiCMTbB (ORCPT ); Sun, 13 Mar 2022 15:31:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E82014D604 for ; Sun, 13 Mar 2022 12:29:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 97BEBB80CF8 for ; Sun, 13 Mar 2022 19:29:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1588C340E8; Sun, 13 Mar 2022 19:29:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647199791; bh=UOpshoQL5wNElzDvJvmD94VczSXO1d5Ji6JC3kIUJCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M4qNMxtobic8vI4B/oKgtfTQZz7KK7mpB3gEuTPokEA+fXx9sfyXJcCheg4bb2GN/ cErjmWc0npSJKWY0w6AsL14fwxrBPmGkA2OOuvUdRbD5EMhBw9QW7x5VSTT2Gfc5Hh HouZHgnZz7VTU6oYdVD9G3zheGxlxzrdN2gDUj6eoTf3CbcXjzfQuInWCgCDSihsZ5 xcL0a+Nfil3uNjI+I3s4NGDnF9+BnapTGclTACKTuxomJGHNk4f7bUMFIApCYmepBA /6hgs3nBmWopvATAOfj656sLrTYAwzvgP5Xyb3z6ms+5QWhegQrjBeaXCRfmxd0Yb7 sf+YrAiDQPvyw== From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Paul Walmsley , Greentime Hu , Lorenzo Pieralisi , Rob Herring , Xiaowei Song , Binghui Wang , Bjorn Helgaas Subject: [PATCH 5/5] PCI: ibmphp: Remove unused assignments Date: Sun, 13 Mar 2022 14:29:33 -0500 Message-Id: <20220313192933.434746-6-helgaas@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220313192933.434746-1-helgaas@kernel.org> References: <20220313192933.434746-1-helgaas@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Bjorn Helgaas Remove variables and assignments that are never used. Found by Krzysztof Wilczyński using cppcheck, e.g.: $ cppcheck --enable=all --force unreadVariable drivers/pci/hotplug/ibmphp_res.c:1958 Variable 'bus_sec' is assigned a value that is never used. Signed-off-by: Bjorn Helgaas --- drivers/pci/hotplug/ibmphp_hpc.c | 2 -- drivers/pci/hotplug/ibmphp_res.c | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/pci/hotplug/ibmphp_hpc.c b/drivers/pci/hotplug/ibmphp_hpc.c index 508a62a6b5f9..a5720d12e573 100644 --- a/drivers/pci/hotplug/ibmphp_hpc.c +++ b/drivers/pci/hotplug/ibmphp_hpc.c @@ -325,11 +325,9 @@ static u8 i2c_ctrl_write(struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 static u8 isa_ctrl_read(struct controller *ctlr_ptr, u8 offset) { u16 start_address; - u16 end_address; u8 data; start_address = ctlr_ptr->u.isa_ctlr.io_start; - end_address = ctlr_ptr->u.isa_ctlr.io_end; data = inb(start_address + offset); return data; } diff --git a/drivers/pci/hotplug/ibmphp_res.c b/drivers/pci/hotplug/ibmphp_res.c index ae9acc77d14f..4a72ade2cddb 100644 --- a/drivers/pci/hotplug/ibmphp_res.c +++ b/drivers/pci/hotplug/ibmphp_res.c @@ -1955,7 +1955,7 @@ static int __init update_bridge_ranges(struct bus_node **bus) bus_sec = find_bus_wprev(sec_busno, NULL, 0); /* this bus structure doesn't exist yet, PPB was configured during previous loading of ibmphp */ if (!bus_sec) { - bus_sec = alloc_error_bus(NULL, sec_busno, 1); + alloc_error_bus(NULL, sec_busno, 1); /* the rest will be populated during NVRAM call */ return 0; } @@ -2114,6 +2114,5 @@ static int __init update_bridge_ranges(struct bus_node **bus) } /* end for function */ } /* end for device */ - bus = &bus_cur; return 0; }