All of lore.kernel.org
 help / color / mirror / Atom feed
From: Huang Rui <ray.huang@amd.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Tom St Denis" <tom.stdenis@amd.com>,
	"David Airlie" <airlied@linux.ie>,
	kernel-janitors@vger.kernel.org, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Evan Quan" <evan.quan@amd.com>, "Rex Zhu" <Rex.Zhu@amd.com>,
	"Christian K�nig" <christian.koenig@amd.com>
Subject: Re: [PATCH] drm/amd/pp: silence a static checker warning
Date: Mon, 26 Mar 2018 11:30:25 +0800	[thread overview]
Message-ID: <20180326033024.GC27239@hr-amur2> (raw)
In-Reply-To: <20180323113903.GD28518@mwanda>

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
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: Huang Rui <ray.huang@amd.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Tom St Denis" <tom.stdenis@amd.com>,
	"David Airlie" <airlied@linux.ie>,
	kernel-janitors@vger.kernel.org, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Evan Quan" <evan.quan@amd.com>, "Rex Zhu" <Rex.Zhu@amd.com>,
	"Christian K�nig" <christian.koenig@amd.com>
Subject: Re: [PATCH] drm/amd/pp: silence a static checker warning
Date: Mon, 26 Mar 2018 03:30:25 +0000	[thread overview]
Message-ID: <20180326033024.GC27239@hr-amur2> (raw)
In-Reply-To: <20180323113903.GD28518@mwanda>

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

  reply	other threads:[~2018-03-26  3:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-23 11:39 [PATCH] drm/amd/pp: silence a static checker warning Dan Carpenter
2018-03-23 11:39 ` Dan Carpenter
2018-03-26  3:30 ` Huang Rui [this message]
2018-03-26  3:30   ` Huang Rui
2018-03-27  8:59   ` rezhu
2018-03-27  8:59     ` rezhu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180326033024.GC27239@hr-amur2 \
    --to=ray.huang@amd.com \
    --cc=Rex.Zhu@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=evan.quan@amd.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=tom.stdenis@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.