tree:   https://gitlab.freedesktop.org/drm/misc/kernel.git drm-misc-next
head:   779ec12c85c9e4547519e3903a371a3b26a289de
commit: dbf21777caa8b8c88c12f7f036b01208fec0d55a [3/5] drm: verisilicon: add a 
driver for Verisilicon display controllers
config: parisc-allyesconfig 
(https://download.01.org/0day-ci/archive/20260206/[email protected]/config)
compiler: hppa-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20260206/[email protected]/reproduce)

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]/

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/verisilicon/vs_dc.c: In function 'vs_dc_probe':
>> drivers/gpu/drm/verisilicon/vs_dc.c:146:64: warning: '%u' directive output 
>> may be truncated writing between 1 and 10 bytes into a region of size 2 
>> [-Wformat-truncation=]
     146 |                 snprintf(pixclk_name, sizeof(pixclk_name), "pix%u", 
i);
         |                                                                ^~
   drivers/gpu/drm/verisilicon/vs_dc.c:146:60: note: directive argument in the 
range [0, 4294967294]
     146 |                 snprintf(pixclk_name, sizeof(pixclk_name), "pix%u", 
i);
         |                                                            ^~~~~~~
   drivers/gpu/drm/verisilicon/vs_dc.c:146:17: note: 'snprintf' output between 
5 and 14 bytes into a destination of size 5
     146 |                 snprintf(pixclk_name, sizeof(pixclk_name), "pix%u", 
i);
         |                 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +146 drivers/gpu/drm/verisilicon/vs_dc.c

    42  
    43  static int vs_dc_probe(struct platform_device *pdev)
    44  {
    45          struct device *dev = &pdev->dev;
    46          struct vs_dc *dc;
    47          void __iomem *regs;
    48          unsigned int port_count, i;
    49          /* pix0/pix1 */
    50          char pixclk_name[5];
    51          int irq, ret;
    52  
    53          if (!dev->of_node) {
    54                  dev_err(dev, "can't find DC devices\n");
    55                  return -ENODEV;
    56          }
    57  
    58          port_count = of_graph_get_port_count(dev->of_node);
    59          if (!port_count) {
    60                  dev_err(dev, "can't find DC downstream ports\n");
    61                  return -ENODEV;
    62          }
    63          if (port_count > VSDC_MAX_OUTPUTS) {
    64                  dev_err(dev, "too many DC downstream ports than 
possible\n");
    65                  return -EINVAL;
    66          }
    67  
    68          ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
    69          if (ret) {
    70                  dev_err(dev, "No suitable DMA available\n");
    71                  return ret;
    72          }
    73  
    74          dc = devm_kzalloc(dev, sizeof(*dc), GFP_KERNEL);
    75          if (!dc)
    76                  return -ENOMEM;
    77  
    78          dc->rsts[0].id = "core";
    79          dc->rsts[1].id = "axi";
    80          dc->rsts[2].id = "ahb";
    81  
    82          ret = devm_reset_control_bulk_get_optional_shared(dev, 
VSDC_RESET_COUNT,
    83                                                            dc->rsts);
    84          if (ret) {
    85                  dev_err(dev, "can't get reset lines\n");
    86                  return ret;
    87          }
    88  
    89          dc->core_clk = devm_clk_get_enabled(dev, "core");
    90          if (IS_ERR(dc->core_clk)) {
    91                  dev_err(dev, "can't get core clock\n");
    92                  return PTR_ERR(dc->core_clk);
    93          }
    94  
    95          dc->axi_clk = devm_clk_get_enabled(dev, "axi");
    96          if (IS_ERR(dc->axi_clk)) {
    97                  dev_err(dev, "can't get axi clock\n");
    98                  return PTR_ERR(dc->axi_clk);
    99          }
   100  
   101          dc->ahb_clk = devm_clk_get_enabled(dev, "ahb");
   102          if (IS_ERR(dc->ahb_clk)) {
   103                  dev_err(dev, "can't get ahb clock\n");
   104                  return PTR_ERR(dc->ahb_clk);
   105          }
   106  
   107          irq = platform_get_irq(pdev, 0);
   108          if (irq < 0) {
   109                  dev_err(dev, "can't get irq\n");
   110                  return irq;
   111          }
   112  
   113          ret = reset_control_bulk_deassert(VSDC_RESET_COUNT, dc->rsts);
   114          if (ret) {
   115                  dev_err(dev, "can't deassert reset lines\n");
   116                  return ret;
   117          }
   118  
   119          regs = devm_platform_ioremap_resource(pdev, 0);
   120          if (IS_ERR(regs)) {
   121                  dev_err(dev, "can't map registers");
   122                  ret = PTR_ERR(regs);
   123                  goto err_rst_assert;
   124          }
   125  
   126          dc->regs = devm_regmap_init_mmio(dev, regs, &vs_dc_regmap_cfg);
   127          if (IS_ERR(dc->regs)) {
   128                  ret = PTR_ERR(dc->regs);
   129                  goto err_rst_assert;
   130          }
   131  
   132          ret = vs_fill_chip_identity(dc->regs, &dc->identity);
   133          if (ret)
   134                  goto err_rst_assert;
   135  
   136          dev_info(dev, "Found DC%x rev %x customer %x\n", 
dc->identity.model,
   137                   dc->identity.revision, dc->identity.customer_id);
   138  
   139          if (port_count > dc->identity.display_count) {
   140                  dev_err(dev, "too many downstream ports than HW 
capability\n");
   141                  ret = -EINVAL;
   142                  goto err_rst_assert;
   143          }
   144  
   145          for (i = 0; i < dc->identity.display_count; i++) {
 > 146                  snprintf(pixclk_name, sizeof(pixclk_name), "pix%u", i);
   147                  dc->pix_clk[i] = devm_clk_get(dev, pixclk_name);
   148                  if (IS_ERR(dc->pix_clk[i])) {
   149                          dev_err(dev, "can't get pixel clk %u\n", i);
   150                          ret = PTR_ERR(dc->pix_clk[i]);
   151                          goto err_rst_assert;
   152                  }
   153          }
   154  
   155          ret = devm_request_irq(dev, irq, vs_dc_irq_handler, 0,
   156                                 dev_name(dev), dc);
   157          if (ret) {
   158                  dev_err(dev, "can't request irq\n");
   159                  goto err_rst_assert;
   160          }
   161  
   162          dev_set_drvdata(dev, dc);
   163  
   164          ret = vs_drm_initialize(dc, pdev);
   165          if (ret)
   166                  goto err_rst_assert;
   167  
   168          return 0;
   169  
   170  err_rst_assert:
   171          reset_control_bulk_assert(VSDC_RESET_COUNT, dc->rsts);
   172          return ret;
   173  }
   174  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Reply via email to