public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@stusta.de>
To: gregkh@suse.de, kristen.c.accardi@intel.com
Cc: linux-kernel@vger.kernel.org, linux-pci@atrey.karlin.mff.cuni.cz
Subject: [2.6 patch] cpqphp_ctrl.c: remove dead code
Date: Mon, 23 Jul 2007 16:51:05 +0200	[thread overview]
Message-ID: <20070723145105.GK26212@stusta.de> (raw)

If !mem_node we did already return -ENOMEM above in the function.

Spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@stusta.de>

---

 drivers/pci/hotplug/cpqphp_ctrl.c |   28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)

--- linux-2.6.22-rc6-mm1/drivers/pci/hotplug/cpqphp_ctrl.c.old	2007-07-23 15:13:27.000000000 +0200
+++ linux-2.6.22-rc6-mm1/drivers/pci/hotplug/cpqphp_ctrl.c	2007-07-23 15:15:22.000000000 +0200
@@ -2558,29 +2558,15 @@ static int configure_new_function(struct
 			hold_IO_node = NULL;
 		}
 
-		/* If we have memory resources copy them and fill in the
-		 * bridge's memory range registers.  Otherwise, fill in the
-		 * range registers with values that disable them. */
-		if (mem_node) {
-			memcpy(hold_mem_node, mem_node, sizeof(struct pci_resource));
-			mem_node->next = NULL;
-
-			/* set Mem base and Limit registers */
-			temp_word = mem_node->base >> 16;
-			rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
+		memcpy(hold_mem_node, mem_node, sizeof(struct pci_resource));
+		mem_node->next = NULL;
 
-			temp_word = (mem_node->base + mem_node->length - 1) >> 16;
-			rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
-		} else {
-			temp_word = 0xFFFF;
-			rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
-
-			temp_word = 0x0000;
-			rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
+		/* set Mem base and Limit registers */
+		temp_word = mem_node->base >> 16;
+		rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
 
-			kfree(hold_mem_node);
-			hold_mem_node = NULL;
-		}
+		temp_word = (mem_node->base + mem_node->length - 1) >> 16;
+		rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
 
 		memcpy(hold_p_mem_node, p_mem_node, sizeof(struct pci_resource));
 		p_mem_node->next = NULL;


             reply	other threads:[~2007-07-23 14:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-23 14:51 Adrian Bunk [this message]
2007-08-09 21:51 ` [2.6 patch] cpqphp_ctrl.c: remove dead code Kristen Carlson Accardi
2007-08-09 22:24   ` Greg KH
2007-08-09 22:47     ` Kristen Carlson Accardi
2007-08-09 23:04       ` Adrian Bunk
2007-08-09 23:13         ` Kristen Carlson Accardi
2007-08-09 23:28           ` Alan Cox
2007-08-09 23:20         ` Kristen Carlson Accardi
2007-08-09 23:39           ` Adrian Bunk
2007-08-13 16:05             ` Kristen Carlson Accardi
2007-08-09 23:20       ` Alan Cox
2007-08-11  3:42       ` Christoph Hellwig
2007-08-13 16:37         ` Kristen Carlson Accardi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070723145105.GK26212@stusta.de \
    --to=bunk@stusta.de \
    --cc=gregkh@suse.de \
    --cc=kristen.c.accardi@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@atrey.karlin.mff.cuni.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox