public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2.6 patch] ipmi_demangle_device_id(): remove dead code
@ 2007-10-22  2:48 Adrian Bunk
  2007-10-22  3:58 ` Corey Minyard
  0 siblings, 1 reply; 2+ messages in thread
From: Adrian Bunk @ 2007-10-22  2:48 UTC (permalink / raw)
  To: Corey Minyard; +Cc: openipmi-developer, linux-kernel

This patch removes obviously dead code spotted by the Coverity checker.

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

---

 include/linux/ipmi_smi.h |   10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

--- linux-2.6/include/linux/ipmi_smi.h.old	2007-10-21 23:03:03.000000000 +0200
+++ linux-2.6/include/linux/ipmi_smi.h	2007-10-21 23:05:59.000000000 +0200
@@ -158,44 +158,38 @@ static inline int ipmi_demangle_device_i
 	if (data_len < 9)
 		return -EINVAL;
 	if (data[0] != IPMI_NETFN_APP_RESPONSE << 2 ||
 	    data[1] != IPMI_GET_DEVICE_ID_CMD)
 		/* Strange, didn't get the response we expected. */
 		return -EINVAL;
 	if (data[2] != 0)
 		/* That's odd, it shouldn't be able to fail. */
 		return -EINVAL;
 
 	data += 3;
 	data_len -= 3;
 	id->device_id = data[0];
 	id->device_revision = data[1];
 	id->firmware_revision_1 = data[2];
 	id->firmware_revision_2 = data[3];
 	id->ipmi_version = data[4];
 	id->additional_device_support = data[5];
-	if (data_len >= 6) {
-		id->manufacturer_id = (data[6] | (data[7] << 8) |
-				       (data[8] << 16));
-		id->product_id = data[9] | (data[10] << 8);
-	} else {
-		id->manufacturer_id = 0;
-		id->product_id = 0;
-	}
+	id->manufacturer_id = (data[6] | (data[7] << 8) | (data[8] << 16));
+	id->product_id = data[9] | (data[10] << 8);
 	if (data_len >= 15) {
 		memcpy(id->aux_firmware_revision, data+11, 4);
 		id->aux_firmware_revision_set = 1;
 	} else
 		id->aux_firmware_revision_set = 0;
 
 	return 0;
 }
 
 /* Add a low-level interface to the IPMI driver.  Note that if the
    interface doesn't know its slave address, it should pass in zero.
    The low-level interface should not deliver any messages to the
    upper layer until the start_processing() function in the handlers
    is called, and the lower layer must get the interface from that
    call. */
 int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
 		      void                     *send_info,
 		      struct ipmi_device_id    *device_id,

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [2.6 patch] ipmi_demangle_device_id(): remove dead code
  2007-10-22  2:48 [2.6 patch] ipmi_demangle_device_id(): remove dead code Adrian Bunk
@ 2007-10-22  3:58 ` Corey Minyard
  0 siblings, 0 replies; 2+ messages in thread
From: Corey Minyard @ 2007-10-22  3:58 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: openipmi-developer, linux-kernel

Yes, it's a problem, but wrong fix.  Thanks, I'll send a patch for it.

-corey

Adrian Bunk wrote:
> This patch removes obviously dead code spotted by the Coverity checker.
>
> Signed-off-by: Adrian Bunk <bunk@kernel.org>
>
> ---
>
>  include/linux/ipmi_smi.h |   10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
>
> --- linux-2.6/include/linux/ipmi_smi.h.old	2007-10-21 23:03:03.000000000 +0200
> +++ linux-2.6/include/linux/ipmi_smi.h	2007-10-21 23:05:59.000000000 +0200
> @@ -158,44 +158,38 @@ static inline int ipmi_demangle_device_i
>  	if (data_len < 9)
>  		return -EINVAL;
>  	if (data[0] != IPMI_NETFN_APP_RESPONSE << 2 ||
>  	    data[1] != IPMI_GET_DEVICE_ID_CMD)
>  		/* Strange, didn't get the response we expected. */
>  		return -EINVAL;
>  	if (data[2] != 0)
>  		/* That's odd, it shouldn't be able to fail. */
>  		return -EINVAL;
>  
>  	data += 3;
>  	data_len -= 3;
>  	id->device_id = data[0];
>  	id->device_revision = data[1];
>  	id->firmware_revision_1 = data[2];
>  	id->firmware_revision_2 = data[3];
>  	id->ipmi_version = data[4];
>  	id->additional_device_support = data[5];
> -	if (data_len >= 6) {
> -		id->manufacturer_id = (data[6] | (data[7] << 8) |
> -				       (data[8] << 16));
> -		id->product_id = data[9] | (data[10] << 8);
> -	} else {
> -		id->manufacturer_id = 0;
> -		id->product_id = 0;
> -	}
> +	id->manufacturer_id = (data[6] | (data[7] << 8) | (data[8] << 16));
> +	id->product_id = data[9] | (data[10] << 8);
>  	if (data_len >= 15) {
>  		memcpy(id->aux_firmware_revision, data+11, 4);
>  		id->aux_firmware_revision_set = 1;
>  	} else
>  		id->aux_firmware_revision_set = 0;
>  
>  	return 0;
>  }
>  
>  /* Add a low-level interface to the IPMI driver.  Note that if the
>     interface doesn't know its slave address, it should pass in zero.
>     The low-level interface should not deliver any messages to the
>     upper layer until the start_processing() function in the handlers
>     is called, and the lower layer must get the interface from that
>     call. */
>  int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
>  		      void                     *send_info,
>  		      struct ipmi_device_id    *device_id,
>   


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-10-22  3:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-22  2:48 [2.6 patch] ipmi_demangle_device_id(): remove dead code Adrian Bunk
2007-10-22  3:58 ` Corey Minyard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox