From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Mon, 04 Apr 2016 11:16:57 +0000 Subject: [patch] ipmi_ssif: silence an uninitialized variable warning Message-Id: <20160404111657.GA26910@mwanda> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Corey Minyard Cc: openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org My static checker complains that "ret" could be zero here. (Presumably that means the hardware is badly busted). But the result would be that the caller assumes *resp_len is initialized when it's not and it leads to a warning. Let's just silence the warning. Signed-off-by: Dan Carpenter diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c index 8b3be8b..512c5b6 100644 --- a/drivers/char/ipmi/ipmi_ssif.c +++ b/drivers/char/ipmi/ipmi_ssif.c @@ -1232,6 +1232,8 @@ static int do_cmd(struct i2c_client *client, int len, unsigned char *msg, break; } + if (ret = 0) + ret = -EINVAL; if (ret > 0) { /* Validate that the response is correct. */ if (ret < 3 || From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932368AbcDDLRU (ORCPT ); Mon, 4 Apr 2016 07:17:20 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:31641 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753436AbcDDLRR (ORCPT ); Mon, 4 Apr 2016 07:17:17 -0400 Date: Mon, 4 Apr 2016 14:16:57 +0300 From: Dan Carpenter To: Corey Minyard Cc: openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] ipmi_ssif: silence an uninitialized variable warning Message-ID: <20160404111657.GA26910@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org My static checker complains that "ret" could be zero here. (Presumably that means the hardware is badly busted). But the result would be that the caller assumes *resp_len is initialized when it's not and it leads to a warning. Let's just silence the warning. Signed-off-by: Dan Carpenter diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c index 8b3be8b..512c5b6 100644 --- a/drivers/char/ipmi/ipmi_ssif.c +++ b/drivers/char/ipmi/ipmi_ssif.c @@ -1232,6 +1232,8 @@ static int do_cmd(struct i2c_client *client, int len, unsigned char *msg, break; } + if (ret == 0) + ret = -EINVAL; if (ret > 0) { /* Validate that the response is correct. */ if (ret < 3 ||