drivers/gpu/drm/bridge/waveshare-dsi.c:70 ws_bridge_attach_dsi() warn: unsigned 'dsi->lanes' is never less than zero.
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 3f9cd19e764b782706dbaacc69e502099cb014ba commit: fca11428425e92bf21d4a7f5865708c5e64430e4 [3018/4342] drm/bridge: waveshare-dsi: Add support for 1..4 DSI data lanes config: powerpc-randconfig-r073-20260305 (https://download.01.org/0day-ci/archive/20260306/[email protected]/config) compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project c32caeec8158d634bb71ab8911a6031248b9fc47) smatch: v0.5.0-9004-gb810ac53
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
smatch warnings:drivers/gpu/drm/bridge/waveshare-dsi.c:70 ws_bridge_attach_dsi() warn: unsigned 'dsi->lanes' is never less than zero.
vim +70 drivers/gpu/drm/bridge/waveshare-dsi.c
38
39 static int ws_bridge_attach_dsi(struct ws_bridge *ws)
40 {
41 const struct mipi_dsi_device_info info = {
42 .type = "ws-bridge",
43 .channel = 0,
44 .node = NULL,
45 };
46 struct device_node *dsi_host_node;
47 struct device *dev = ws->dev;
48 struct mipi_dsi_device *dsi;
49 struct mipi_dsi_host *host;
50 int ret;
51
52 dsi_host_node = of_graph_get_remote_node(dev->of_node, 0, 0);
53 if (!dsi_host_node) {
54 dev_err(dev, "Failed to get remote port\n");
55 return -ENODEV;
56 }
57 host = of_find_mipi_dsi_host_by_node(dsi_host_node);
58 of_node_put(dsi_host_node);
59 if (!host)
60 return dev_err_probe(dev, -EPROBE_DEFER, "Failed to find dsi_host\n");
61
62 dsi = devm_mipi_dsi_device_register_full(dev, host, &info);
63 if (IS_ERR(dsi))
64 return dev_err_probe(dev, PTR_ERR(dsi), "Failed to create dsi device\n");
65
66 dsi->mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO |
67 MIPI_DSI_CLOCK_NON_CONTINUOUS;
68 dsi->format = MIPI_DSI_FMT_RGB888;
69 dsi->lanes = drm_of_get_data_lanes_count_ep(dev->of_node, 0, 0, 1, 4);
> 70 if (dsi->lanes < 0) {
71 dev_warn(dev, "Invalid or missing DSI lane count %d, falling back to 2 lanes\n",
72 dsi->lanes);
73 dsi->lanes = 2; /* Old DT backward compatibility */
74 }
75
76 ret = devm_mipi_dsi_attach(dev, dsi);
77 if (ret < 0)
78 return dev_err_probe(dev, ret, "Failed to attach dsi to host\n");
79
80 return 0;
81 }
82 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki