public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/pp: silence a static checker warning
@ 2018-03-23 11:39 Dan Carpenter
  2018-03-26  3:30 ` Huang Rui
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2018-03-23 11:39 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Tom St Denis, David Airlie, kernel-janitors, amd-gfx, dri-devel,
	Evan Quan, Rex Zhu, Christian König

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>

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;
 	}
 

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

* Re: [PATCH] drm/amd/pp: silence a static checker warning
  2018-03-23 11:39 [PATCH] drm/amd/pp: silence a static checker warning Dan Carpenter
@ 2018-03-26  3:30 ` Huang Rui
  2018-03-27  8:59   ` rezhu
  0 siblings, 1 reply; 3+ messages in thread
From: Huang Rui @ 2018-03-26  3:30 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Tom St Denis, David Airlie, kernel-janitors, amd-gfx, dri-devel,
	Alex Deucher, Evan Quan, Rex Zhu, Christian K�nig

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

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

* Re: [PATCH] drm/amd/pp: silence a static checker warning
  2018-03-26  3:30 ` Huang Rui
@ 2018-03-27  8:59   ` rezhu
  0 siblings, 0 replies; 3+ messages in thread
From: rezhu @ 2018-03-27  8:59 UTC (permalink / raw)
  To: Huang Rui, Dan Carpenter
  Cc: Tom St Denis, David (ChunMing) Zhou, David Airlie,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Alex Deucher,
	Evan Quan, Rex Zhu, Christian K�nig

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


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

end of thread, other threads:[~2018-03-27  8:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-23 11:39 [PATCH] drm/amd/pp: silence a static checker warning Dan Carpenter
2018-03-26  3:30 ` Huang Rui
2018-03-27  8:59   ` rezhu

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