[bug report] media: chips-media: wave5: Add the v4l2 layer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Nas Chung,

The patch 9707a6254a8a: "media: chips-media: wave5: Add the v4l2
layer" from Nov 8, 2023 (linux-next), leads to the following Smatch
static checker warning:

	drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c:387 handle_dynamic_resolution_change()
	warn: sleeping in atomic context

drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c
    359 static int handle_dynamic_resolution_change(struct vpu_instance *inst)
    360 {
    361         struct v4l2_fh *fh = &inst->v4l2_fh;
    362         struct v4l2_m2m_ctx *m2m_ctx = inst->v4l2_fh.m2m_ctx;
    363 
    364         static const struct v4l2_event vpu_event_src_ch = {
    365                 .type = V4L2_EVENT_SOURCE_CHANGE,
    366                 .u.src_change.changes = V4L2_EVENT_SRC_CH_RESOLUTION,
    367         };
    368         struct dec_info *p_dec_info = &inst->codec_info->dec_info;
    369         struct dec_initial_info *initial_info = &inst->codec_info->dec_info.initial_info;
    370 
    371         lockdep_assert_held(&inst->state_spinlock);
                                     ^^^^^^^^^^^^^^^^^^^^
We are holding a spinlock.

    372 
    373         dev_dbg(inst->dev->dev, "%s: rd_ptr %pad", __func__, &initial_info->rd_ptr);
    374 
    375         dev_dbg(inst->dev->dev, "%s: width: %u height: %u profile: %u | minbuffer: %u\n",
    376                 __func__, initial_info->pic_width, initial_info->pic_height,
    377                 initial_info->profile, initial_info->min_frame_buffer_count);
    378 
    379         inst->needs_reallocation = true;
    380         inst->fbc_buf_count = initial_info->min_frame_buffer_count + 1;
    381         if (inst->fbc_buf_count != v4l2_m2m_num_dst_bufs_ready(m2m_ctx)) {
    382                 struct v4l2_ctrl *ctrl;
    383 
    384                 ctrl = v4l2_ctrl_find(&inst->v4l2_ctrl_hdl,
    385                                       V4L2_CID_MIN_BUFFERS_FOR_CAPTURE);
    386                 if (ctrl)
--> 387                         v4l2_ctrl_s_ctrl(ctrl, inst->fbc_buf_count);
                                ^^^^^^^^^^^^^^^^
v4l2_ctrl_lock() is a sleeping lock (mutex).  So we can't call it while
holding a spinlock.

    388         }
    389 
    390         if (p_dec_info->initial_info_obtained) {
    391                 inst->conf_win.left = initial_info->pic_crop_rect.left;
    392                 inst->conf_win.top = initial_info->pic_crop_rect.top;
    393                 inst->conf_win.width = initial_info->pic_width -
    394                         initial_info->pic_crop_rect.left - initial_info->pic_crop_rect.right;
    395                 inst->conf_win.height = initial_info->pic_height -
    396                         initial_info->pic_crop_rect.top - initial_info->pic_crop_rect.bottom;
    397 
    398                 wave5_update_pix_fmt(&inst->src_fmt, initial_info->pic_width,
    399                                      initial_info->pic_height);
    400                 wave5_update_pix_fmt(&inst->dst_fmt, initial_info->pic_width,
    401                                      initial_info->pic_height);
    402         }
    403 
    404         v4l2_event_queue_fh(fh, &vpu_event_src_ch);
    405 
    406         return 0;
    407 }

regards,
dan carpenter




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux