drivers/tty/serial/8250/8250_ni.c:277:12: warning: stack frame size (1072) exceeds limit (1024) in 'ni16550_probe'
From: kernel test robot
Date: Wed Jul 02 2025 - 17:41:31 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b4911fb0b060899e4eebca0151eb56deb86921ec
commit: 3d5390f4dbe633472b2a4824e66ca5c4eac6fb19 serial: 8250: add driver for NI UARTs
date: 3 months ago
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20250703/202507030557.vIewJJQO-lkp@xxxxxxxxx/config)
compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250703/202507030557.vIewJJQO-lkp@xxxxxxxxx/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 <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507030557.vIewJJQO-lkp@xxxxxxxxx/
All warnings (new ones prefixed by >>):
>> drivers/tty/serial/8250/8250_ni.c:277:12: warning: stack frame size (1072) exceeds limit (1024) in 'ni16550_probe' [-Wframe-larger-than]
277 | static int ni16550_probe(struct platform_device *pdev)
| ^
1 warning generated.
vim +/ni16550_probe +277 drivers/tty/serial/8250/8250_ni.c
276
> 277 static int ni16550_probe(struct platform_device *pdev)
278 {
279 const struct ni16550_device_info *info;
280 struct device *dev = &pdev->dev;
281 struct uart_8250_port uart = {};
282 unsigned int txfifosz, rxfifosz;
283 unsigned int prescaler = 0;
284 struct ni16550_data *data;
285 const char *portmode;
286 bool rs232_property;
287 int ret;
288 int irq;
289
290 data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
291 if (!data)
292 return -ENOMEM;
293
294 spin_lock_init(&uart.port.lock);
295
296 irq = platform_get_irq(pdev, 0);
297 if (irq < 0)
298 return irq;
299
300 ret = ni16550_get_regs(pdev, &uart.port);
301 if (ret < 0)
302 return ret;
303
304 /* early setup so that serial_in()/serial_out() work */
305 serial8250_set_defaults(&uart);
306
307 info = device_get_match_data(dev);
308
309 uart.port.dev = dev;
310 uart.port.irq = irq;
311 uart.port.irqflags = IRQF_SHARED;
312 uart.port.flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF
313 | UPF_FIXED_PORT | UPF_FIXED_TYPE;
314 uart.port.startup = ni16550_port_startup;
315 uart.port.shutdown = ni16550_port_shutdown;
316
317 /*
318 * Hardware instantiation of FIFO sizes are held in registers.
319 */
320 txfifosz = ni16550_read_fifo_size(&uart, NI16550_TFS_OFFSET);
321 rxfifosz = ni16550_read_fifo_size(&uart, NI16550_RFS_OFFSET);
322
323 dev_dbg(dev, "NI 16550 has TX FIFO size %u, RX FIFO size %u\n",
324 txfifosz, rxfifosz);
325
326 uart.port.type = PORT_16550A;
327 uart.port.fifosize = txfifosz;
328 uart.tx_loadsz = txfifosz;
329 uart.fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10;
330 uart.capabilities = UART_CAP_FIFO | UART_CAP_AFE | UART_CAP_EFR;
331
332 /*
333 * Declaration of the base clock frequency can come from one of:
334 * - static declaration in this driver (for older ACPI IDs)
335 * - a "clock-frquency" ACPI
336 */
337 if (info->uartclk)
338 uart.port.uartclk = info->uartclk;
339 if (device_property_read_u32(dev, "clock-frequency",
340 &uart.port.uartclk)) {
341 data->clk = devm_clk_get_enabled(dev, NULL);
342 if (!IS_ERR(data->clk))
343 uart.port.uartclk = clk_get_rate(data->clk);
344 }
345
346 if (!uart.port.uartclk) {
347 dev_err(dev, "unable to determine clock frequency!\n");
348 ret = -ENODEV;
349 goto err;
350 }
351
352 if (info->prescaler)
353 prescaler = info->prescaler;
354 device_property_read_u32(dev, "clock-prescaler", &prescaler);
355
356 if (prescaler != 0) {
357 uart.port.set_mctrl = ni16550_set_mctrl;
358 ni16550_config_prescaler(&uart, (u8)prescaler);
359 }
360
361 /*
362 * The determination of whether or not this is an RS-485 or RS-232 port
363 * can come from the PMR (if present), otherwise we're solely an RS-485
364 * port.
365 *
366 * This is a device-specific property, and there are old devices in the
367 * field using "transceiver" as an ACPI property, so we have to check
368 * for that as well.
369 */
370 if (!device_property_read_string(dev, "transceiver", &portmode)) {
371 rs232_property = strncmp(portmode, "RS-232", 6) == 0;
372
373 dev_dbg(dev, "port is in %s mode (via device property)\n",
374 rs232_property ? "RS-232" : "RS-485");
375 } else if (info->flags & NI_HAS_PMR) {
376 rs232_property = is_pmr_rs232_mode(&uart);
377
378 dev_dbg(dev, "port is in %s mode (via PMR)\n",
379 rs232_property ? "RS-232" : "RS-485");
380 } else {
381 rs232_property = 0;
382
383 dev_dbg(dev, "port is fixed as RS-485\n");
384 }
385
386 if (!rs232_property) {
387 /*
388 * Neither the 'transceiver' property nor the PMR indicate
389 * that this is an RS-232 port, so it must be an RS-485 one.
390 */
391 ni16550_rs485_setup(&uart.port);
392 }
393
394 ret = serial8250_register_8250_port(&uart);
395 if (ret < 0)
396 goto err;
397 data->line = ret;
398
399 platform_set_drvdata(pdev, data);
400 return 0;
401
402 err:
403 return ret;
404 }
405
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki