Hello Dmitry Baryshkov,

The patch f35fe63fcf14: "drm/msm/dpu: shift IRQ indices by 1" from
Aug 2, 2023 (linux-next), leads to the following Smatch static
checker warning:

        drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c:371 
dpu_encoder_helper_wait_for_irq()
        warn: unsigned 'irq_idx' is never less than zero.

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
    349 int dpu_encoder_helper_wait_for_irq(struct dpu_encoder_phys *phys_enc,
    350                 unsigned int irq_idx,
                        ^^^^^^^^^^^^^^^^^^^^
The patch makes this unsigned

    351                 void (*func)(void *arg),
    352                 struct dpu_encoder_wait_info *wait_info)
    353 {
    354         u32 irq_status;
    355         int ret;
    356 
    357         if (!wait_info) {
    358                 DPU_ERROR("invalid params\n");
    359                 return -EINVAL;
    360         }
    361         /* note: do master / slave checking outside */
    362 
    363         /* return EWOULDBLOCK since we know the wait isn't necessary */
    364         if (phys_enc->enable_state == DPU_ENC_DISABLED) {
    365                 DRM_ERROR("encoder is disabled id=%u, callback=%ps, 
IRQ=[%d, %d]\n",
    366                           DRMID(phys_enc->parent), func,
    367                           DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx));
    368                 return -EWOULDBLOCK;
    369         }
    370 
--> 371         if (irq_idx < 0) {
                    ^^^^^^^^^^^
It looks like this can be safely removed

    372                 DRM_DEBUG_KMS("skip irq wait id=%u, callback=%ps\n",
    373                               DRMID(phys_enc->parent), func);
    374                 return 0;
    375         }
    376 

regards,
dan carpenter

Reply via email to