public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@kernel.org>
To: gregkh@suse.de
Cc: linux-kernel@vger.kernel.org, linux-pci@atrey.karlin.mff.cuni.cz
Subject: [2.6 patch] cpqhp_pushbutton_thread(): remove a pointless if() check
Date: Wed, 24 Oct 2007 18:25:00 +0200	[thread overview]
Message-ID: <20071024162500.GS30533@stusta.de> (raw)

The Coverity checker spotted that we'd have already oops'ed if "ctrl"
was NULL.

Additionally, "func" had just been checked for not being NULL.

Signed-off-by: Adrian Bunk <bunk@kernel.org>

---

This patch has been sent on:
- 14 Aug 2007

--- linux-2.6.23-rc1-mm2/drivers/pci/hotplug/cpqphp_ctrl.c.old	2007-08-08 14:00:24.000000000 +0200
+++ linux-2.6.23-rc1-mm2/drivers/pci/hotplug/cpqphp_ctrl.c	2007-08-08 14:01:16.000000000 +0200
@@ -1951,30 +1951,28 @@ void cpqhp_pushbutton_thread(unsigned lo
 	if (is_slot_enabled(ctrl, hp_slot)) {
 		p_slot->state = POWEROFF_STATE;
 		/* power Down board */
 		func = cpqhp_slot_find(p_slot->bus, p_slot->device, 0);
 		dbg("In power_down_board, func = %p, ctrl = %p\n", func, ctrl);
 		if (!func) {
 			dbg("Error! func NULL in %s\n", __FUNCTION__);
 			return ;
 		}
 
-		if (func != NULL && ctrl != NULL) {
-			if (cpqhp_process_SS(ctrl, func) != 0) {
-				amber_LED_on (ctrl, hp_slot);
-				green_LED_on (ctrl, hp_slot);
-				
-				set_SOGO(ctrl);
+		if (cpqhp_process_SS(ctrl, func) != 0) {
+			amber_LED_on (ctrl, hp_slot);
+			green_LED_on (ctrl, hp_slot);
+			
+			set_SOGO(ctrl);
 
-				/* Wait for SOBS to be unset */
-				wait_for_ctrl_irq (ctrl);
-			}
+			/* Wait for SOBS to be unset */
+			wait_for_ctrl_irq (ctrl);
 		}
 
 		p_slot->state = STATIC_STATE;
 	} else {
 		p_slot->state = POWERON_STATE;
 		/* slot is off */
 
 		func = cpqhp_slot_find(p_slot->bus, p_slot->device, 0);
 		dbg("In add_board, func = %p, ctrl = %p\n", func, ctrl);
 		if (!func) {


             reply	other threads:[~2007-10-24 16:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-24 16:25 Adrian Bunk [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-08-14 21:22 [2.6 patch] cpqhp_pushbutton_thread(): remove a pointless if() check Adrian Bunk

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=20071024162500.GS30533@stusta.de \
    --to=bunk@kernel.org \
    --cc=gregkh@suse.de \
    --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