[bug report] Staging: media: Unmap and release region obtained by ioremap_nocache

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

 



Hello Arvind Yadav,

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

The patch 4b4eda001704: "Staging: media: Unmap and release region 
obtained by ioremap_nocache" from Mar 17, 2017, leads to the 
following Smatch complaint:

drivers/staging/media/davinci_vpfe/dm365_ipipe.c:1846 vpfe_ipipe_init()
	 error: we previously assumed 'res' could be null (see line 1809)

drivers/staging/media/davinci_vpfe/dm365_ipipe.c
  1808		res = platform_get_resource(pdev, IORESOURCE_MEM, 6);
  1809		if (!res)
  1810			goto error_unmap;
                        ^^^^^^^^^^^^^^^^
This used to be a direct return.

  1811		ipipe->isp5_base_addr = ioremap_nocache(res->start, res_len);
  1812		if (!ipipe->isp5_base_addr)
  1813			goto error_unmap;
  1814	
  1815		v4l2_subdev_init(sd, &ipipe_v4l2_ops);
  1816		sd->internal_ops = &ipipe_v4l2_internal_ops;
  1817		strlcpy(sd->name, "DAVINCI IPIPE", sizeof(sd->name));
  1818		sd->grp_id = 1 << 16;	/* group ID for davinci subdevs */
  1819		v4l2_set_subdevdata(sd, ipipe);
  1820		sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
  1821	
  1822		pads[IPIPE_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
  1823		pads[IPIPE_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
  1824	
  1825		ipipe->input = IPIPE_INPUT_NONE;
  1826		ipipe->output = IPIPE_OUTPUT_NONE;
  1827	
  1828		me->ops = &ipipe_media_ops;
  1829		v4l2_ctrl_handler_init(&ipipe->ctrls, 2);
  1830		v4l2_ctrl_new_std(&ipipe->ctrls, &ipipe_ctrl_ops,
  1831				  V4L2_CID_BRIGHTNESS, 0,
  1832				  IPIPE_BRIGHT_HIGH, 1, 16);
  1833		v4l2_ctrl_new_std(&ipipe->ctrls, &ipipe_ctrl_ops,
  1834				  V4L2_CID_CONTRAST, 0,
  1835				  IPIPE_CONTRAST_HIGH, 1, 16);
  1836	
  1837	
  1838		v4l2_ctrl_handler_setup(&ipipe->ctrls);
  1839		sd->ctrl_handler = &ipipe->ctrls;
  1840	
  1841		return media_entity_pads_init(me, IPIPE_PADS_NUM, pads);
  1842	
  1843	error_unmap:
  1844		iounmap(ipipe->base_addr);
  1845	error_release:
  1846		release_mem_region(res->start, res_len);
                                   ^^^^^^^^^^
This will Oops.

  1847		return -ENOMEM;
  1848	}

regards,
dan carpenter
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux