Hi Mirela,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on shawnguo/for-next robh/for-next linus/master v5.11 
next-20210222]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    
https://github.com/0day-ci/linux/commits/Mirela-Rabulea/Add-V4L2-driver-for-i-MX8-JPEG-Encoder-Decoder/20210223-031832
base:   git://linuxtv.org/media_tree.git master
config: x86_64-randconfig-m001-20210222 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

smatch warnings:
drivers/media/platform/imx-jpeg/mxc-jpeg.c:1220 mxc_jpeg_parse() warn: 
inconsistent indenting

vim +1220 drivers/media/platform/imx-jpeg/mxc-jpeg.c

  1190  
  1191  static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx,
  1192                            u8 *src_addr, u32 size, bool *dht_needed)
  1193  {
  1194          struct device *dev = ctx->mxc_jpeg->dev;
  1195          struct mxc_jpeg_q_data *q_data_out, *q_data_cap;
  1196          enum v4l2_buf_type cap_type = 
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
  1197          bool src_chg = false;
  1198          u32 fourcc;
  1199          struct v4l2_jpeg_header header;
  1200          struct mxc_jpeg_sof *psof = NULL;
  1201          struct mxc_jpeg_sos *psos = NULL;
  1202          int ret;
  1203  
  1204          memset(&header, 0, sizeof(header));
  1205          ret = v4l2_jpeg_parse_header((void *)src_addr, size, &header);
  1206          if (ret < 0) {
  1207                  dev_err(dev, "Error parsing JPEG stream markers\n");
  1208                  return ret;
  1209          }
  1210  
  1211          /* if DHT marker present, no need to inject default one */
  1212          *dht_needed = (header.num_dht == 0);
  1213  
  1214          q_data_out = mxc_jpeg_get_q_data(ctx,
  1215                                           
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
  1216          if (q_data_out->w == 0 && q_data_out->h == 0) {
  1217                  dev_warn(dev, "Invalid user resolution 0x0");
  1218                  dev_warn(dev, "Keeping resolution from JPEG: %dx%d",
  1219                           header.frame.width, header.frame.height);
> 1220                   q_data_out->w = header.frame.width;
  1221                   q_data_out->h = header.frame.height;
  1222          } else if (header.frame.width != q_data_out->w ||
  1223                     header.frame.height != q_data_out->h) {
  1224                  dev_err(dev,
  1225                          "Resolution mismatch: %dx%d (JPEG) versus 
%dx%d(user)",
  1226                          header.frame.width, header.frame.height,
  1227                          q_data_out->w, q_data_out->h);
  1228                  return -EINVAL;
  1229          }
  1230          if (header.frame.width % 8 != 0 || header.frame.height % 8 != 
0) {
  1231                  dev_err(dev, "JPEG width or height not multiple of 8: 
%dx%d\n",
  1232                          header.frame.width, header.frame.height);
  1233                  return -EINVAL;
  1234          }
  1235          if (header.frame.width > MXC_JPEG_MAX_WIDTH ||
  1236              header.frame.height > MXC_JPEG_MAX_HEIGHT) {
  1237                  dev_err(dev, "JPEG width or height should be <= 8192: 
%dx%d\n",
  1238                          header.frame.width, header.frame.height);
  1239                  return -EINVAL;
  1240          }
  1241          if (header.frame.width < MXC_JPEG_MIN_WIDTH ||
  1242              header.frame.height < MXC_JPEG_MIN_HEIGHT) {
  1243                  dev_err(dev, "JPEG width or height should be > 64: 
%dx%d\n",
  1244                          header.frame.width, header.frame.height);
  1245                  return -EINVAL;
  1246          }
  1247          if (header.frame.num_components > V4L2_JPEG_MAX_COMPONENTS) {
  1248                  dev_err(dev, "JPEG number of components should be <=%d",
  1249                          V4L2_JPEG_MAX_COMPONENTS);
  1250                  return -EINVAL;
  1251          }
  1252          /* check and, if necessary, patch component IDs*/
  1253          psof = (struct mxc_jpeg_sof *)header.sof.start;
  1254          psos = (struct mxc_jpeg_sos *)header.sos.start;
  1255          if (!mxc_jpeg_valid_comp_id(dev, psof, psos))
  1256                  dev_warn(dev, "JPEG component ids should be 0-3 or 
1-4");
  1257  
  1258          fourcc = mxc_jpeg_get_image_format(dev, header);
  1259          if (fourcc == 0)
  1260                  return -EINVAL;
  1261  
  1262          /*
  1263           * set-up the capture queue with the pixelformat and resolution
  1264           * detected from the jpeg output stream
  1265           */
  1266          q_data_cap = mxc_jpeg_get_q_data(ctx, cap_type);
  1267          if (q_data_cap->w != header.frame.width ||
  1268              q_data_cap->h != header.frame.height)
  1269                  src_chg = true;
  1270          q_data_cap->w = header.frame.width;
  1271          q_data_cap->h = header.frame.height;
  1272          q_data_cap->fmt = mxc_jpeg_find_format(ctx, fourcc);
  1273          q_data_cap->w_adjusted = q_data_cap->w;
  1274          q_data_cap->h_adjusted = q_data_cap->h;
  1275          /*
  1276           * align up the resolution for CAST IP,
  1277           * but leave the buffer resolution unchanged
  1278           */
  1279          v4l_bound_align_image(&q_data_cap->w_adjusted,
  1280                                q_data_cap->w_adjusted,  /* adjust up */
  1281                                MXC_JPEG_MAX_WIDTH,
  1282                                q_data_cap->fmt->h_align,
  1283                                &q_data_cap->h_adjusted,
  1284                                q_data_cap->h_adjusted, /* adjust up */
  1285                                MXC_JPEG_MAX_HEIGHT,
  1286                                q_data_cap->fmt->v_align,
  1287                                0);
  1288          dev_dbg(dev, "Detected jpeg res=(%dx%d)->(%dx%d), 
pixfmt=%c%c%c%c\n",
  1289                  q_data_cap->w, q_data_cap->h,
  1290                  q_data_cap->w_adjusted, q_data_cap->h_adjusted,
  1291                  (fourcc & 0xff),
  1292                  (fourcc >>  8) & 0xff,
  1293                  (fourcc >> 16) & 0xff,
  1294                  (fourcc >> 24) & 0xff);
  1295  
  1296          /* setup bytesperline/sizeimage for capture queue */
  1297          mxc_jpeg_bytesperline(q_data_cap, header.frame.precision);
  1298          mxc_jpeg_sizeimage(q_data_cap);
  1299  
  1300          /*
  1301           * if the CAPTURE format was updated with new values, 
regardless of
  1302           * whether they match the values set by the client or not, 
signal
  1303           * a source change event
  1304           */
  1305          if (src_chg)
  1306                  notify_src_chg(ctx);
  1307  
  1308          return 0;
  1309  }
  1310  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

Reply via email to