diff mbox

drm/amd/pp: silence a static checker warning

Message ID 20180323113903.GD28518@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter March 23, 2018, 11:39 a.m. UTC
This has a static checker warning because "frev" and "crev" can be
uninitialized if "info" is NULL.  I just changed the order of the checks
so that we check "info" first.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Huang Rui March 26, 2018, 3:30 a.m. UTC | #1
On Fri, Mar 23, 2018 at 02:39:03PM +0300, Dan Carpenter wrote:
> This has a static checker warning because "frev" and "crev" can be
> uninitialized if "info" is NULL.  I just changed the order of the checks
> so that we check "info" first.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Huang Rui <ray.huang@amd.com>

> 
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
> index 75a465f771f0..7b26607c646a 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
> @@ -319,13 +319,13 @@ static int smu8_get_system_info_data(struct pp_hwmgr *hwmgr)
>  			GetIndexIntoMasterTable(DATA, IntegratedSystemInfo),
>  			&size, &frev, &crev);
>  
> -	if (crev != 9) {
> -		pr_err("Unsupported IGP table: %d %d\n", frev, crev);
> +	if (info == NULL) {
> +		pr_err("Could not retrieve the Integrated System Info Table!\n");
>  		return -EINVAL;
>  	}
>  
> -	if (info == NULL) {
> -		pr_err("Could not retrieve the Integrated System Info Table!\n");
> +	if (crev != 9) {
> +		pr_err("Unsupported IGP table: %d %d\n", frev, crev);
>  		return -EINVAL;
>  	}
>  
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
rezhu March 27, 2018, 8:59 a.m. UTC | #2
Applied. Thanks.

Best Regards

Rex

On 2018年03月26日 11:30, Huang Rui wrote:
> On Fri, Mar 23, 2018 at 02:39:03PM +0300, Dan Carpenter wrote:
>> This has a static checker warning because "frev" and "crev" can be
>> uninitialized if "info" is NULL.  I just changed the order of the checks
>> so that we check "info" first.
>>
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reviewed-by: Huang Rui <ray.huang@amd.com>
>
>> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
>> index 75a465f771f0..7b26607c646a 100644
>> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
>> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
>> @@ -319,13 +319,13 @@ static int smu8_get_system_info_data(struct pp_hwmgr *hwmgr)
>>   			GetIndexIntoMasterTable(DATA, IntegratedSystemInfo),
>>   			&size, &frev, &crev);
>>   
>> -	if (crev != 9) {
>> -		pr_err("Unsupported IGP table: %d %d\n", frev, crev);
>> +	if (info == NULL) {
>> +		pr_err("Could not retrieve the Integrated System Info Table!\n");
>>   		return -EINVAL;
>>   	}
>>   
>> -	if (info == NULL) {
>> -		pr_err("Could not retrieve the Integrated System Info Table!\n");
>> +	if (crev != 9) {
>> +		pr_err("Unsupported IGP table: %d %d\n", frev, crev);
>>   		return -EINVAL;
>>   	}
>>   
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
index 75a465f771f0..7b26607c646a 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
@@ -319,13 +319,13 @@  static int smu8_get_system_info_data(struct pp_hwmgr *hwmgr)
 			GetIndexIntoMasterTable(DATA, IntegratedSystemInfo),
 			&size, &frev, &crev);
 
-	if (crev != 9) {
-		pr_err("Unsupported IGP table: %d %d\n", frev, crev);
+	if (info == NULL) {
+		pr_err("Could not retrieve the Integrated System Info Table!\n");
 		return -EINVAL;
 	}
 
-	if (info == NULL) {
-		pr_err("Could not retrieve the Integrated System Info Table!\n");
+	if (crev != 9) {
+		pr_err("Unsupported IGP table: %d %d\n", frev, crev);
 		return -EINVAL;
 	}