linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: [media] media: ti-vpe: Add CAL v4l2 camera capture driver
@ 2016-02-03  4:53 Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2016-02-03  4:53 UTC (permalink / raw)
  To: bparrot; +Cc: linux-media

Hello Benoit Parrot,

The patch 343e89a792a5: "[media] media: ti-vpe: Add CAL v4l2 camera
capture driver" from Jan 6, 2016, leads to the following static
checker warning:

	drivers/media/platform/ti-vpe/cal.c:1218 cal_enum_frameintervals()
	info: ignoring unreachable code.

drivers/media/platform/ti-vpe/cal.c
  1197  /* timeperframe is arbitrary and continuous */
  1198  static int cal_enum_frameintervals(struct file *file, void *priv,
  1199                                     struct v4l2_frmivalenum *fival)
  1200  {
  1201          struct cal_ctx *ctx = video_drvdata(file);
  1202          const struct cal_fmt *fmt;
  1203          struct v4l2_subdev_frame_size_enum fse;
  1204          int ret;
  1205  
  1206          if (fival->index)
  1207                  return -EINVAL;
  1208  
  1209          fmt = find_format_by_pix(ctx, fival->pixel_format);
  1210          if (!fmt)
  1211                  return -EINVAL;
  1212  
  1213          /* check for valid width/height */
  1214          ret = 0;
  1215          fse.pad = 0;
  1216          fse.code = fmt->code;
  1217          fse.which = V4L2_SUBDEV_FORMAT_ACTIVE;
  1218          for (fse.index = 0; ; fse.index++) {
                                      ^^^^^^^^^^^
We never do this increment.  Is this stub code that was accidentally
committed or how is this loop supposed to work?

  1219                  ret = v4l2_subdev_call(ctx->sensor, pad, enum_frame_size,
  1220                                         NULL, &fse);
  1221                  if (ret)
  1222                          return -EINVAL;
  1223  
  1224                  if ((fival->width == fse.max_width) &&
  1225                      (fival->height == fse.max_height))
  1226                          break;
  1227                  else if ((fival->width >= fse.min_width) &&
  1228                           (fival->width <= fse.max_width) &&
  1229                           (fival->height >= fse.min_height) &&
  1230                           (fival->height <= fse.max_height))
  1231                          break;
  1232  
  1233                  return -EINVAL;
  1234          }
  1235  
  1236          fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
  1237          fival->discrete.numerator = 1;
  1238          fival->discrete.denominator = 30;
  1239  
  1240          return 0;

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* re: [media] media: ti-vpe: Add CAL v4l2 camera capture driver
@ 2016-02-03  5:00 Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2016-02-03  5:00 UTC (permalink / raw)
  To: bparrot; +Cc: linux-media

Hello Benoit Parrot,

This is a semi-automatic email about new static checker warnings.

The patch 343e89a792a5: "[media] media: ti-vpe: Add CAL v4l2 camera 
capture driver" from Jan 6, 2016, leads to the following Smatch 
complaint:

drivers/media/platform/ti-vpe/cal.c:1349 cal_start_streaming()
	 warn: variable dereferenced before check 'ctx->sensor' (see line 1332)

drivers/media/platform/ti-vpe/cal.c
  1331	
  1332		ret = cal_get_external_info(ctx);
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
Dereferenced inside function call.

  1333		if (ret < 0)
  1334			goto err;
  1335	
  1336		cal_runtime_get(ctx->dev);
  1337	
  1338		enable_irqs(ctx);
  1339		camerarx_phy_enable(ctx);
  1340		csi2_init(ctx);
  1341		csi2_phy_config(ctx);
  1342		csi2_lane_config(ctx);
  1343		csi2_ctx_config(ctx);
  1344		pix_proc_config(ctx);
  1345		cal_wr_dma_config(ctx, ctx->v_fmt.fmt.pix.bytesperline);
  1346		cal_wr_dma_addr(ctx, addr);
  1347		csi2_ppi_enable(ctx);
  1348	
  1349		if (ctx->sensor) {
                    ^^^^^^^^^^^
Checked too late.

  1350			if (v4l2_subdev_call(ctx->sensor, video, s_stream, 1)) {
  1351				ctx_err(ctx, "stream on failed in subdev\n");

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-03  5:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-03  4:53 [media] media: ti-vpe: Add CAL v4l2 camera capture driver Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2016-02-03  5:00 Dan Carpenter

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).