linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: jsanka@codeaurora.org
Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: [bug report] drm/msm: Add SDM845 DPU support
Date: Fri, 1 Oct 2021 17:21:42 +0300	[thread overview]
Message-ID: <20211001142142.GA11487@kili> (raw)

Hello Jeykumar Sankaran,

The patch 25fdd5933e4c: "drm/msm: Add SDM845 DPU support" from Jun
27, 2018, leads to the following
Smatch static checker warning:

	drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c:359 dpu_encoder_phys_cmd_tearcheck_config()
	warn: 'vsync_hz' unsigned <= 0

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c
    322 static void dpu_encoder_phys_cmd_tearcheck_config(
    323                 struct dpu_encoder_phys *phys_enc)
    324 {
    325         struct dpu_encoder_phys_cmd *cmd_enc =
    326                 to_dpu_encoder_phys_cmd(phys_enc);
    327         struct dpu_hw_tear_check tc_cfg = { 0 };
    328         struct drm_display_mode *mode;
    329         bool tc_enable = true;
    330         u32 vsync_hz;
                ^^^^^^^^^^^^

    331         struct dpu_kms *dpu_kms;
    332 
    333         if (!phys_enc->hw_pp) {
    334                 DPU_ERROR("invalid encoder\n");
    335                 return;
    336         }
    337         mode = &phys_enc->cached_mode;
    338 
    339         DPU_DEBUG_CMDENC(cmd_enc, "pp %d\n", phys_enc->hw_pp->idx - PINGPONG_0);
    340 
    341         if (!phys_enc->hw_pp->ops.setup_tearcheck ||
    342                 !phys_enc->hw_pp->ops.enable_tearcheck) {
    343                 DPU_DEBUG_CMDENC(cmd_enc, "tearcheck not supported\n");
    344                 return;
    345         }
    346 
    347         dpu_kms = phys_enc->dpu_kms;
    348 
    349         /*
    350          * TE default: dsi byte clock calculated base on 70 fps;
    351          * around 14 ms to complete a kickoff cycle if te disabled;
    352          * vclk_line base on 60 fps; write is faster than read;
    353          * init == start == rdptr;
    354          *
    355          * vsync_count is ratio of MDP VSYNC clock frequency to LCD panel
    356          * frequency divided by the no. of rows (lines) in the LCDpanel.
    357          */
    358         vsync_hz = dpu_kms_get_clk_rate(dpu_kms, "vsync");
--> 359         if (vsync_hz <= 0) {

dpu_kms_get_clk_rate() returns -EINVAL (but cast to u64).  The "vsync_hz"
variable is a u32 so it can't be less than zero and the -EINVAL is
treated as a success.

    360                 DPU_DEBUG_CMDENC(cmd_enc, "invalid - vsync_hz %u\n",
    361                                  vsync_hz);
    362                 return;
    363         }
    364 
    365         tc_cfg.vsync_count = vsync_hz /
    366                                 (mode->vtotal * drm_mode_vrefresh(mode));

regards,
dan carpenter

regards,
dan carpenter

             reply	other threads:[~2021-10-01 14:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01 14:21 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-10-04 13:46 [bug report] drm/msm: Add SDM845 DPU support Dan Carpenter
2021-10-01 13:49 Dan Carpenter
2021-10-01 13:50 ` Dan Carpenter
2021-10-01 19:03   ` jesszhan
2021-10-19 23:37   ` Jessica Zhang
2021-10-01 12:28 Dan Carpenter
2021-10-01 19:04 ` jesszhan

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=20211001142142.GA11487@kili \
    --to=dan.carpenter@oracle.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jsanka@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).