[xlnx:xlnx_rebase_v5.4 478/1704] drivers/media/platform/xilinx/xilinx-csi2rxss.c:1828 xcsi2rxss_probe() warn: always true condition '(rate < 197000000000) => (0-u32max < 197000000000)'

kernel test robot lkp at intel.com
Wed Apr 7 20:07:15 BST 2021


tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.4
head:   914337937cb6a106a2942347d8c8feacd2223299
commit: 8caa8fb47aa0429f2a25100cf4f957463ba00801 [478/1704] v4l: xilinx: xcsi2rxss: Add support for clock framework
config: i386-randconfig-m021-20210407 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

smatch warnings:
drivers/media/platform/xilinx/xilinx-csi2rxss.c:1828 xcsi2rxss_probe() warn: always true condition '(rate < 197000000000) => (0-u32max < 197000000000)'
drivers/media/platform/xilinx/xilinx-csi2rxss.c:1828 xcsi2rxss_probe() warn: impossible condition '(rate > 203000000000) => (0-u32max > 203000000000)'

vim +1828 drivers/media/platform/xilinx/xilinx-csi2rxss.c

  1759	
  1760	static int xcsi2rxss_probe(struct platform_device *pdev)
  1761	{
  1762		struct v4l2_subdev *subdev;
  1763		struct xcsi2rxss_state *xcsi2rxss;
  1764		struct resource *res;
  1765		const struct of_device_id *match;
  1766		struct device_node *node = pdev->dev.of_node;
  1767		u32 i;
  1768		int ret;
  1769		int num_ctrls;
  1770	
  1771		xcsi2rxss = devm_kzalloc(&pdev->dev, sizeof(*xcsi2rxss), GFP_KERNEL);
  1772		if (!xcsi2rxss)
  1773			return -ENOMEM;
  1774	
  1775		mutex_init(&xcsi2rxss->lock);
  1776	
  1777		xcsi2rxss->core.dev = &pdev->dev;
  1778	
  1779		match = of_match_node(xcsi2rxss_of_id_table, node);
  1780		if (!match)
  1781			return -ENODEV;
  1782	
  1783		xcsi2rxss->core.cfg = match->data;
  1784	
  1785		ret = xcsi2rxss_parse_of(xcsi2rxss);
  1786		if (ret < 0)
  1787			return ret;
  1788	
  1789		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  1790		xcsi2rxss->core.iomem = devm_ioremap_resource(xcsi2rxss->core.dev, res);
  1791		if (IS_ERR(xcsi2rxss->core.iomem))
  1792			return PTR_ERR(xcsi2rxss->core.iomem);
  1793	
  1794		if (xcsi2rxss->core.cfg->flags & XCSI_CLK_PROP) {
  1795			unsigned long rate;
  1796	
  1797			ret = clk_prepare_enable(xcsi2rxss->core.lite_aclk);
  1798			if (ret) {
  1799				dev_err(&pdev->dev, "failed to enable lite_aclk (%d)\n",
  1800					ret);
  1801				goto clk_err;
  1802			}
  1803	
  1804			ret = clk_prepare_enable(xcsi2rxss->core.video_aclk);
  1805			if (ret) {
  1806				dev_err(&pdev->dev, "failed to enable video_aclk (%d)\n",
  1807					ret);
  1808				goto video_aclk_err;
  1809			}
  1810	
  1811			ret = clk_prepare_enable(xcsi2rxss->core.dphy_clk_200M);
  1812			if (ret) {
  1813				dev_err(&pdev->dev, "failed to enable dphy clk (%d)\n",
  1814					ret);
  1815				goto dphy_clk_err;
  1816			}
  1817	
  1818			ret = clk_set_rate(xcsi2rxss->core.dphy_clk_200M,
  1819					   XCSI_DPHY_CLK_REQ);
  1820			if (ret) {
  1821				dev_err(&pdev->dev, "failed to set dphy clk rate (%d)\n",
  1822					ret);
  1823	
  1824				goto all_clk_err;
  1825			}
  1826	
  1827			rate = clk_get_rate(xcsi2rxss->core.dphy_clk_200M);
> 1828			if (rate < XCSI_DPHY_CLK_MIN && rate > XCSI_DPHY_CLK_MAX) {
  1829				dev_err(&pdev->dev, "Err DPHY Clock = %lu\n",
  1830					rate);
  1831				ret = -EINVAL;
  1832				goto all_clk_err;
  1833			}
  1834		}
  1835	
  1836		/*
  1837		 * Reset and initialize the core.
  1838		 */
  1839		xcsi2rxss_reset(&xcsi2rxss->core);
  1840	
  1841		xcsi2rxss->core.events =  (struct xcsi2rxss_event *)&xcsi2rxss_events;
  1842	
  1843		if (xcsi2rxss->core.en_vcx) {
  1844			u32 alloc_size;
  1845	
  1846			alloc_size = sizeof(struct xcsi2rxss_event) *
  1847				     XMIPICSISS_VCX_NUM_EVENTS;
  1848			xcsi2rxss->core.vcx_events = devm_kzalloc(&pdev->dev,
  1849								  alloc_size,
  1850								  GFP_KERNEL);
  1851			if (!xcsi2rxss->core.vcx_events) {
  1852				mutex_destroy(&xcsi2rxss->lock);
  1853				return -ENOMEM;
  1854			}
  1855	
  1856			for (i = 0; i < XMIPICSISS_VCX_NUM_EVENTS; i++)
  1857				xcsi2rxss->core.vcx_events[i].mask = 1 << i;
  1858		}
  1859	
  1860		/* Initialize V4L2 subdevice and media entity */
  1861		xcsi2rxss->pads[0].flags = MEDIA_PAD_FL_SOURCE;
  1862		xcsi2rxss->pads[1].flags = MEDIA_PAD_FL_SINK;
  1863	
  1864		/* Initialize the default format */
  1865		memset(&xcsi2rxss->default_format, 0,
  1866			sizeof(xcsi2rxss->default_format));
  1867		xcsi2rxss->default_format.code = xcsi2rxss->vip_format->code;
  1868		xcsi2rxss->default_format.field = V4L2_FIELD_NONE;
  1869		xcsi2rxss->default_format.colorspace = V4L2_COLORSPACE_SRGB;
  1870		xcsi2rxss->default_format.width = XCSI_DEFAULT_WIDTH;
  1871		xcsi2rxss->default_format.height = XCSI_DEFAULT_HEIGHT;
  1872	
  1873		xcsi2rxss->formats[0] = xcsi2rxss->default_format;
  1874		xcsi2rxss->formats[1] = xcsi2rxss->default_format;
  1875	
  1876		/* Initialize V4L2 subdevice and media entity */
  1877		subdev = &xcsi2rxss->subdev;
  1878		v4l2_subdev_init(subdev, &xcsi2rxss_ops);
  1879	
  1880		subdev->dev = &pdev->dev;
  1881		subdev->internal_ops = &xcsi2rxss_internal_ops;
  1882		strlcpy(subdev->name, dev_name(&pdev->dev), sizeof(subdev->name));
  1883	
  1884		subdev->flags |= V4L2_SUBDEV_FL_HAS_EVENTS | V4L2_SUBDEV_FL_HAS_DEVNODE;
  1885	
  1886		subdev->entity.ops = &xcsi2rxss_media_ops;
  1887	
  1888		v4l2_set_subdevdata(subdev, xcsi2rxss);
  1889	
  1890		ret = media_entity_pads_init(&subdev->entity, 2, xcsi2rxss->pads);
  1891		if (ret < 0)
  1892			goto error;
  1893	
  1894		/*
  1895		 * In case the Enable Active Lanes config parameter is not set,
  1896		 * dynamic lane reconfiguration is not allowed.
  1897		 * So V4L2_CID_XILINX_MIPICSISS_ACT_LANES ctrl will not be registered.
  1898		 * Accordingly allocate the number of controls
  1899		 */
  1900		num_ctrls = ARRAY_SIZE(xcsi2rxss_ctrls);
  1901	
  1902		if (!xcsi2rxss->core.enable_active_lanes)
  1903			num_ctrls--;
  1904	
  1905		dev_dbg(xcsi2rxss->core.dev, "# of ctrls = %d\n", num_ctrls);
  1906	
  1907		v4l2_ctrl_handler_init(&xcsi2rxss->ctrl_handler, num_ctrls);
  1908	
  1909		for (i = 0; i < ARRAY_SIZE(xcsi2rxss_ctrls); i++) {
  1910			struct v4l2_ctrl *ctrl;
  1911	
  1912			if (xcsi2rxss_ctrls[i].id ==
  1913				V4L2_CID_XILINX_MIPICSISS_ACT_LANES) {
  1914	
  1915				if (xcsi2rxss->core.enable_active_lanes) {
  1916					xcsi2rxss_ctrls[i].max =
  1917						xcsi2rxss->core.max_num_lanes;
  1918				} else {
  1919					/* Don't register control */
  1920					dev_dbg(xcsi2rxss->core.dev,
  1921							"Skip active lane control\n");
  1922					continue;
  1923				}
  1924			}
  1925	
  1926			dev_dbg(xcsi2rxss->core.dev, "%d ctrl = 0x%x\n",
  1927					i, xcsi2rxss_ctrls[i].id);
  1928			ctrl = v4l2_ctrl_new_custom(&xcsi2rxss->ctrl_handler,
  1929							&xcsi2rxss_ctrls[i], NULL);
  1930			if (!ctrl) {
  1931				dev_err(xcsi2rxss->core.dev, "Failed for %s ctrl\n",
  1932					xcsi2rxss_ctrls[i].name);
  1933				goto error;
  1934			}
  1935		}
  1936	
  1937		dev_dbg(xcsi2rxss->core.dev, "# v4l2 ctrls registered = %d\n", i - 1);
  1938	
  1939		if (xcsi2rxss->ctrl_handler.error) {
  1940			dev_err(&pdev->dev, "failed to add controls\n");
  1941			ret = xcsi2rxss->ctrl_handler.error;
  1942			goto error;
  1943		}
  1944	
  1945		subdev->ctrl_handler = &xcsi2rxss->ctrl_handler;
  1946	
  1947		ret = v4l2_ctrl_handler_setup(&xcsi2rxss->ctrl_handler);
  1948		if (ret < 0) {
  1949			dev_err(&pdev->dev, "failed to set controls\n");
  1950			goto error;
  1951		}
  1952	
  1953		platform_set_drvdata(pdev, xcsi2rxss);
  1954	
  1955		dev_info(xcsi2rxss->core.dev, "Xilinx CSI2 Rx Subsystem device found!\n");
  1956	
  1957		ret = v4l2_async_register_subdev(subdev);
  1958		if (ret < 0) {
  1959			dev_err(&pdev->dev, "failed to register subdev\n");
  1960			goto error;
  1961		}
  1962	
  1963		/* default states for streaming and suspend */
  1964		xcsi2rxss->streaming = false;
  1965		xcsi2rxss->suspended = false;
  1966		return 0;
  1967	
  1968	error:
  1969		v4l2_ctrl_handler_free(&xcsi2rxss->ctrl_handler);
  1970		media_entity_cleanup(&subdev->entity);
  1971		mutex_destroy(&xcsi2rxss->lock);
  1972	
  1973	all_clk_err:
  1974		clk_disable_unprepare(xcsi2rxss->core.dphy_clk_200M);
  1975	dphy_clk_err:
  1976		clk_disable_unprepare(xcsi2rxss->core.video_aclk);
  1977	video_aclk_err:
  1978		clk_disable_unprepare(xcsi2rxss->core.lite_aclk);
  1979	clk_err:
  1980		return ret;
  1981	}
  1982	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 32405 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20210408/d28562c5/attachment-0001.gz>


More information about the linux-arm-kernel mailing list