diff mbox

fsp/fsp-chiptod: Fix uninitialized value

Message ID 1436782343-31024-1-git-send-email-kamalesh@linux.vnet.ibm.com
State Accepted
Headers show

Commit Message

Kamalesh Babulal July 13, 2015, 10:12 a.m. UTC
Initialized variable rc to 0, to fix uninitialized value
issue.

Fixes Coverity defect#101857.

Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Cc: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
---
 hw/fsp/fsp-chiptod.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Vasant Hegde July 13, 2015, 12:51 p.m. UTC | #1
On 07/13/2015 03:42 PM, Kamalesh Babulal wrote:
> Initialized variable rc to 0, to fix uninitialized value
> issue.
> 
> Fixes Coverity defect#101857.
> 
> Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
> Cc: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
> ---
>  hw/fsp/fsp-chiptod.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/fsp/fsp-chiptod.c b/hw/fsp/fsp-chiptod.c
> index 69c59c6..ce7e9ce 100644
> --- a/hw/fsp/fsp-chiptod.c
> +++ b/hw/fsp/fsp-chiptod.c
> @@ -27,7 +27,7 @@ static bool fsp_chiptod_update_topology(uint32_t cmd_sub_mod,
>  	struct fsp_msg *resp;
>  	enum chiptod_topology topo;
>  	bool action;
> -	uint8_t rc;
> +	uint8_t rc = 0;

Better rc = FSP_STATUS_SUCCESS;

-Vasant

>  
>  	switch (cmd_sub_mod) {
>  	case FSP_CMD_TOPO_ENABLE_DISABLE:
>
Kamalesh Babulal July 13, 2015, 1:03 p.m. UTC | #2
On 07/13/2015 06:21 PM, Vasant Hegde wrote:
> On 07/13/2015 03:42 PM, Kamalesh Babulal wrote:
>> Initialized variable rc to 0, to fix uninitialized value
>> issue.
>>
>> Fixes Coverity defect#101857.
>>
>> Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
>> Cc: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
>> ---
>>  hw/fsp/fsp-chiptod.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/fsp/fsp-chiptod.c b/hw/fsp/fsp-chiptod.c
>> index 69c59c6..ce7e9ce 100644
>> --- a/hw/fsp/fsp-chiptod.c
>> +++ b/hw/fsp/fsp-chiptod.c
>> @@ -27,7 +27,7 @@ static bool fsp_chiptod_update_topology(uint32_t cmd_sub_mod,
>>  	struct fsp_msg *resp;
>>  	enum chiptod_topology topo;
>>  	bool action;
>> -	uint8_t rc;
>> +	uint8_t rc = 0;
> Better rc = FSP_STATUS_SUCCESS;
>
Thanks for the review. I was under the assumption that
FSP_STATUS_SUCCESS was used
for value from read from (msg->resp->word1 >> 8) & 0xff. Given that
FSP_STATUS_SUCCESS
is also 0, is it ok to be used in this case also.
Mahesh J Salgaonkar Aug. 13, 2015, 8:31 a.m. UTC | #3
On 07/13/2015 03:42 PM, Kamalesh Babulal wrote:
> Initialized variable rc to 0, to fix uninitialized value
> issue.
> 
> Fixes Coverity defect#101857.
> 
> Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>

Acked-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>

> Cc: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
> ---
>  hw/fsp/fsp-chiptod.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/fsp/fsp-chiptod.c b/hw/fsp/fsp-chiptod.c
> index 69c59c6..ce7e9ce 100644
> --- a/hw/fsp/fsp-chiptod.c
> +++ b/hw/fsp/fsp-chiptod.c
> @@ -27,7 +27,7 @@ static bool fsp_chiptod_update_topology(uint32_t cmd_sub_mod,
>  	struct fsp_msg *resp;
>  	enum chiptod_topology topo;
>  	bool action;
> -	uint8_t rc;
> +	uint8_t rc = 0;
> 
>  	switch (cmd_sub_mod) {
>  	case FSP_CMD_TOPO_ENABLE_DISABLE:
>
diff mbox

Patch

diff --git a/hw/fsp/fsp-chiptod.c b/hw/fsp/fsp-chiptod.c
index 69c59c6..ce7e9ce 100644
--- a/hw/fsp/fsp-chiptod.c
+++ b/hw/fsp/fsp-chiptod.c
@@ -27,7 +27,7 @@  static bool fsp_chiptod_update_topology(uint32_t cmd_sub_mod,
 	struct fsp_msg *resp;
 	enum chiptod_topology topo;
 	bool action;
-	uint8_t rc;
+	uint8_t rc = 0;
 
 	switch (cmd_sub_mod) {
 	case FSP_CMD_TOPO_ENABLE_DISABLE: