mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Abhinav Kumar <quic_abhinavk@quicinc.com>
To: sunliming <sunliming@kylinos.cn>, <robdclark@gmail.com>,
	<dmitry.baryshkov@linaro.org>
Cc: <linux-kernel@vger.kernel.org>, <kelulanainsley@gmail.com>,
	"kernel test robot" <lkp@intel.com>,
	Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH] drm/msm/dpu: Fix variable dereferenced before check
Date: Tue, 21 Jun 2022 10:42:46 -0700	[thread overview]
Message-ID: <d4b882ba-b773-5271-6050-416c8f3cad4b@quicinc.com> (raw)
In-Reply-To: <20220621110634.368913-1-sunliming@kylinos.cn>



On 6/21/2022 4:06 AM, sunliming wrote:
> Fixes the following smatch warning:
> 
> drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c:261
> dpu_encoder_phys_wb_atomic_check() warn: variable dereferenced before check 'conn_state'
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: sunliming <sunliming@kylinos.cn>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>

> ---
>   drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c
> index 59da348ff339..0ec809ab06e7 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c
> @@ -252,11 +252,6 @@ static int dpu_encoder_phys_wb_atomic_check(
>   	DPU_DEBUG("[atomic_check:%d, \"%s\",%d,%d]\n",
>   			phys_enc->wb_idx, mode->name, mode->hdisplay, mode->vdisplay);
>   
> -	if (!conn_state->writeback_job || !conn_state->writeback_job->fb)
> -		return 0;
> -
> -	fb = conn_state->writeback_job->fb;
> -
>   	if (!conn_state || !conn_state->connector) {
>   		DPU_ERROR("invalid connector state\n");
>   		return -EINVAL;
> @@ -267,6 +262,11 @@ static int dpu_encoder_phys_wb_atomic_check(
>   		return -EINVAL;
>   	}
>   
> +	if (!conn_state->writeback_job || !conn_state->writeback_job->fb)
> +		return 0;
> +
> +	fb = conn_state->writeback_job->fb;
> +
>   	DPU_DEBUG("[fb_id:%u][fb:%u,%u]\n", fb->base.id,
>   			fb->width, fb->height);
>   

  reply	other threads:[~2022-06-21 17:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-21 11:06 sunliming
2022-06-21 17:42 ` Abhinav Kumar [this message]
2022-06-21 17:44   ` Abhinav Kumar
2022-06-21 17:49     ` Dmitry Baryshkov
2022-06-22 17:28       ` Abhinav Kumar

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=d4b882ba-b773-5271-6050-416c8f3cad4b@quicinc.com \
    --to=quic_abhinavk@quicinc.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=kelulanainsley@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=robdclark@gmail.com \
    --cc=sunliming@kylinos.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®