Hi "Mirela, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on linuxtv-media/master] [also build test WARNING on linus/master next-20201215] [cannot apply to shawnguo/for-next robh/for-next v5.10] [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-OSS/Add-V4L2-driver-for-i-MX8-JPEG-Encoder-Decoder/20201215-192653 base: git://linuxtv.org/media_tree.git master config: x86_64-randconfig-m001-20201215 (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 <lkp@xxxxxxxxx> smatch warnings: drivers/media/platform/imx-jpeg/mxc-jpeg.c:1408 mxc_jpeg_parse() warn: inconsistent indenting vim +1408 drivers/media/platform/imx-jpeg/mxc-jpeg.c 1321 1322 static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, 1323 u8 *src_addr, u32 size, bool *dht_needed) 1324 { 1325 struct device *dev = ctx->mxc_jpeg->dev; 1326 struct mxc_jpeg_q_data *q_data_out, *q_data_cap; 1327 enum v4l2_buf_type cap_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; 1328 struct mxc_jpeg_stream stream; 1329 bool notfound = true; 1330 bool app14 = false; 1331 bool src_chg = false; 1332 u8 app14_transform = 0; 1333 struct mxc_jpeg_sof sof, *psof = NULL; 1334 struct mxc_jpeg_sos *psos = NULL; 1335 int byte; 1336 u8 *next = NULL; 1337 enum mxc_jpeg_image_format img_fmt; 1338 u32 fourcc; 1339 1340 memset(&sof, 0, sizeof(struct mxc_jpeg_sof)); 1341 stream.addr = src_addr; 1342 stream.end = size; 1343 stream.loc = 0; 1344 *dht_needed = true; 1345 1346 /* check stream starts with SOI */ 1347 byte = get_byte(&stream); 1348 if (byte == -1 || byte != 0xFF) 1349 return -EINVAL; 1350 byte = get_byte(&stream); 1351 if (byte == -1 || byte != 0xD8) 1352 return -EINVAL; 1353 1354 while (notfound) { 1355 byte = get_byte(&stream); 1356 if (byte == -1) 1357 return -EINVAL; 1358 if (byte != 0xff) 1359 continue; 1360 do { 1361 byte = get_byte(&stream); 1362 } while (byte == 0xff); 1363 if (byte == -1) 1364 return false; 1365 if (byte == 0) 1366 continue; 1367 switch (byte) { 1368 case DHT: 1369 /* DHT marker present, no need to inject default one */ 1370 *dht_needed = false; 1371 break; 1372 case SOF2: /* Progressive DCF frame definition */ 1373 dev_err(dev, 1374 "Progressive JPEG not supported by hardware"); 1375 return -EINVAL; 1376 case SOF1: /* Extended sequential DCF frame definition */ 1377 case SOF0: /* Baseline sequential DCF frame definition */ 1378 if (get_sof(dev, &stream, &sof) == -1) 1379 break; 1380 next = stream.addr + stream.loc; 1381 psof = (struct mxc_jpeg_sof *)next; 1382 break; 1383 case SOS: 1384 next = stream.addr + stream.loc; 1385 psos = (struct mxc_jpeg_sos *)next; 1386 notfound = false; 1387 break; 1388 case APP14: 1389 app14 = true; 1390 /* 1391 * Application Data Syntax is: 1392 * 2 bytes(APPn:0xFF,0xEE), 2 bytes(Lp), Ap1...ApLp-2 1393 * The transform flag is in Ap12 1394 * stream.loc is now on APPn-0xEE byte 1395 */ 1396 app14_transform = *(stream.addr + stream.loc + 12 + 1); 1397 break; 1398 default: 1399 notfound = true; 1400 } 1401 } 1402 q_data_out = mxc_jpeg_get_q_data(ctx, 1403 V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); 1404 if (q_data_out->w == 0 && q_data_out->h == 0) { 1405 dev_warn(dev, "Invalid user resolution 0x0"); 1406 dev_warn(dev, "Keeping resolution from JPEG: %dx%d", 1407 sof.width, sof.height); > 1408 q_data_out->w = sof.width; 1409 q_data_out->h = sof.height; 1410 } else if (sof.width != q_data_out->w || sof.height != q_data_out->h) { 1411 dev_err(dev, 1412 "Resolution mismatch: %dx%d (JPEG) versus %dx%d(user)", 1413 sof.width, sof.height, q_data_out->w, q_data_out->h); 1414 return -EINVAL; 1415 } 1416 if (sof.width % 8 != 0 || sof.height % 8 != 0) { 1417 dev_err(dev, "JPEG width or height not multiple of 8: %dx%d\n", 1418 sof.width, sof.height); 1419 return -EINVAL; 1420 } 1421 if (sof.width > MXC_JPEG_MAX_WIDTH || 1422 sof.height > MXC_JPEG_MAX_HEIGHT) { 1423 dev_err(dev, "JPEG width or height should be <= 8192: %dx%d\n", 1424 sof.width, sof.height); 1425 return -EINVAL; 1426 } 1427 if (sof.width < MXC_JPEG_MIN_WIDTH || 1428 sof.height < MXC_JPEG_MIN_HEIGHT) { 1429 dev_err(dev, "JPEG width or height should be > 64: %dx%d\n", 1430 sof.width, sof.height); 1431 return -EINVAL; 1432 } 1433 if (sof.components_no > MXC_JPEG_MAX_COMPONENTS) { 1434 dev_err(dev, "JPEG number of components should be <=%d", 1435 MXC_JPEG_MAX_COMPONENTS); 1436 return -EINVAL; 1437 } 1438 /* check and, if necessary, patch component IDs*/ 1439 if (!mxc_jpeg_valid_comp_id(dev, psof, psos)) 1440 dev_warn(dev, "JPEG component ids should be 0-3 or 1-4"); 1441 1442 img_fmt = mxc_jpeg_get_image_format(dev, &sof); 1443 if (img_fmt == MXC_JPEG_INVALID) 1444 return -EINVAL; 1445 1446 /* 1447 * If the transform flag from APP14 marker is 0, images that are 1448 * encoded with 3 components have RGB colorspace, see Recommendation 1449 * ITU-T T.872 chapter 6.5.3 APP14 marker segment for colour encoding 1450 */ 1451 if (img_fmt == MXC_JPEG_YUV444 && app14 && app14_transform == 0) 1452 img_fmt = MXC_JPEG_RGB; 1453 1454 if (mxc_jpeg_imgfmt_to_fourcc(img_fmt, &fourcc)) { 1455 dev_err(dev, "Fourcc not found for %d", img_fmt); 1456 return -EINVAL; 1457 } 1458 1459 /* 1460 * set-up the capture queue with the pixelformat and resolution 1461 * detected from the jpeg output stream 1462 */ 1463 q_data_cap = mxc_jpeg_get_q_data(ctx, cap_type); 1464 if (q_data_cap->w != sof.width || q_data_cap->h != sof.height) 1465 src_chg = true; 1466 q_data_cap->w = sof.width; 1467 q_data_cap->h = sof.height; 1468 q_data_cap->fmt = mxc_jpeg_find_format(ctx, fourcc); 1469 q_data_cap->w_adjusted = q_data_cap->w; 1470 q_data_cap->h_adjusted = q_data_cap->h; 1471 /* 1472 * align up the resolution for CAST IP, 1473 * but leave the buffer resolution unchanged 1474 */ 1475 v4l_bound_align_image(&q_data_cap->w_adjusted, 1476 q_data_cap->w_adjusted, /* adjust up */ 1477 MXC_JPEG_MAX_WIDTH, 1478 q_data_cap->fmt->h_align, 1479 &q_data_cap->h_adjusted, 1480 q_data_cap->h_adjusted, /* adjust up */ 1481 MXC_JPEG_MAX_HEIGHT, 1482 q_data_cap->fmt->v_align, 1483 0); 1484 dev_dbg(dev, "Detected jpeg res=(%dx%d)->(%dx%d), pixfmt=%c%c%c%c\n", 1485 q_data_cap->w, q_data_cap->h, 1486 q_data_cap->w_adjusted, q_data_cap->h_adjusted, 1487 (fourcc & 0xff), 1488 (fourcc >> 8) & 0xff, 1489 (fourcc >> 16) & 0xff, 1490 (fourcc >> 24) & 0xff); 1491 1492 /* setup bytesperline/sizeimage for capture queue */ 1493 mxc_jpeg_bytesperline(q_data_cap, sof.precision); 1494 mxc_jpeg_sizeimage(q_data_cap); 1495 1496 /* 1497 * if the CAPTURE format was updated with new values, regardless of 1498 * whether they match the values set by the client or not, signal 1499 * a source change event 1500 */ 1501 if (src_chg) 1502 notify_src_chg(ctx); 1503 1504 return 0; 1505 } 1506 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip