* [tty:tty-testing 8/24] drivers/tty/serial/qcom_geni_serial.c:274 get_port_from_line() error: Calling ida_alloc_range() with a 'max' argument which is a power of 2. -1 missing?
@ 2025-08-18 6:34 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2025-08-18 0:35 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-serial@vger.kernel.org
TO: Zong Jiang <quic_zongjian@quicinc.com>
CC: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
head: 7cd9f5d6c5a3f31d2b282d31ddc4d78ff83a5c08
commit: 9391ab1ed9b3fe0d1af7d7858d9bf42f476628c8 [8/24] serial: qcom-geni: Make UART port count configurable via Kconfig
:::::: branch date: 14 hours ago
:::::: commit date: 4 days ago
config: parisc-randconfig-r072-20250818 (https://download.01.org/0day-ci/archive/20250818/202508180815.R2nDyajs-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 8.5.0
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@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202508180815.R2nDyajs-lkp@intel.com/
New smatch warnings:
drivers/tty/serial/qcom_geni_serial.c:274 get_port_from_line() error: Calling ida_alloc_range() with a 'max' argument which is a power of 2. -1 missing?
Old smatch warnings:
drivers/tty/serial/qcom_geni_serial.c:1931 qcom_geni_serial_probe() warn: missing unwind goto?
vim +/max +274 drivers/tty/serial/qcom_geni_serial.c
c4f528795d1add Karthikeyan Ramasubramanian 2018-03-14 259
c3e7966c60745f Zong Jiang 2025-08-12 260 static struct qcom_geni_serial_port *get_port_from_line(int line, bool console, struct device *dev)
c4f528795d1add Karthikeyan Ramasubramanian 2018-03-14 261 {
8a8a66a1a18a1d Girish Mahadevan 2018-07-13 262 struct qcom_geni_serial_port *port;
9391ab1ed9b3fe Zong Jiang 2025-08-12 263 int nr_ports = console ? GENI_UART_CONS_PORTS : CONFIG_SERIAL_QCOM_GENI_UART_PORTS;
8a8a66a1a18a1d Girish Mahadevan 2018-07-13 264
a53be6945f5123 Viken Dadhaniya 2025-03-27 265 if (console) {
a53be6945f5123 Viken Dadhaniya 2025-03-27 266 if (line < 0 || line >= nr_ports)
a53be6945f5123 Viken Dadhaniya 2025-03-27 267 return ERR_PTR(-ENXIO);
a53be6945f5123 Viken Dadhaniya 2025-03-27 268
a53be6945f5123 Viken Dadhaniya 2025-03-27 269 port = &qcom_geni_console_port;
a53be6945f5123 Viken Dadhaniya 2025-03-27 270 } else {
a53be6945f5123 Viken Dadhaniya 2025-03-27 271 int max_alias_num = of_alias_get_highest_id("serial");
a53be6945f5123 Viken Dadhaniya 2025-03-27 272
8a8a66a1a18a1d Girish Mahadevan 2018-07-13 273 if (line < 0 || line >= nr_ports)
a53be6945f5123 Viken Dadhaniya 2025-03-27 @274 line = ida_alloc_range(&port_ida, max_alias_num + 1, nr_ports, GFP_KERNEL);
a53be6945f5123 Viken Dadhaniya 2025-03-27 275 else
a53be6945f5123 Viken Dadhaniya 2025-03-27 276 line = ida_alloc_range(&port_ida, line, nr_ports, GFP_KERNEL);
a53be6945f5123 Viken Dadhaniya 2025-03-27 277
a53be6945f5123 Viken Dadhaniya 2025-03-27 278 if (line < 0)
c4f528795d1add Karthikeyan Ramasubramanian 2018-03-14 279 return ERR_PTR(-ENXIO);
8a8a66a1a18a1d Girish Mahadevan 2018-07-13 280
c3e7966c60745f Zong Jiang 2025-08-12 281 port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL);
c3e7966c60745f Zong Jiang 2025-08-12 282 if (!port)
c3e7966c60745f Zong Jiang 2025-08-12 283 return ERR_PTR(-ENOMEM);
c3e7966c60745f Zong Jiang 2025-08-12 284
c3e7966c60745f Zong Jiang 2025-08-12 285 port->uport.iotype = UPIO_MEM;
c3e7966c60745f Zong Jiang 2025-08-12 286 port->uport.ops = &qcom_geni_uart_pops;
c3e7966c60745f Zong Jiang 2025-08-12 287 port->uport.flags = UPF_BOOT_AUTOCONF;
c3e7966c60745f Zong Jiang 2025-08-12 288 port->uport.line = line;
a53be6945f5123 Viken Dadhaniya 2025-03-27 289 }
8a8a66a1a18a1d Girish Mahadevan 2018-07-13 290 return port;
c4f528795d1add Karthikeyan Ramasubramanian 2018-03-14 291 }
c4f528795d1add Karthikeyan Ramasubramanian 2018-03-14 292
:::::: The code at line 274 was first introduced by commit
:::::: a53be6945f5123c19d6fcc30783876705a2e0f00 serial: qcom-geni: Remove alias dependency from qcom serial driver
:::::: TO: Viken Dadhaniya <quic_vdadhani@quicinc.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
* [tty:tty-testing 8/24] drivers/tty/serial/qcom_geni_serial.c:274 get_port_from_line() error: Calling ida_alloc_range() with a 'max' argument which is a power of 2. -1 missing?
@ 2025-08-18 6:34 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2025-08-18 6:34 UTC (permalink / raw)
To: oe-kbuild, Zong Jiang
Cc: lkp, oe-kbuild-all, linux-serial, Greg Kroah-Hartman
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
head: 7cd9f5d6c5a3f31d2b282d31ddc4d78ff83a5c08
commit: 9391ab1ed9b3fe0d1af7d7858d9bf42f476628c8 [8/24] serial: qcom-geni: Make UART port count configurable via Kconfig
config: parisc-randconfig-r072-20250818 (https://download.01.org/0day-ci/archive/20250818/202508180815.R2nDyajs-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 8.5.0
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@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202508180815.R2nDyajs-lkp@intel.com/
New smatch warnings:
drivers/tty/serial/qcom_geni_serial.c:274 get_port_from_line() error: Calling ida_alloc_range() with a 'max' argument which is a power of 2. -1 missing?
Old smatch warnings:
drivers/tty/serial/qcom_geni_serial.c:1931 qcom_geni_serial_probe() warn: missing unwind goto?
vim +/max +274 drivers/tty/serial/qcom_geni_serial.c
c3e7966c60745f Zong Jiang 2025-08-12 260 static struct qcom_geni_serial_port *get_port_from_line(int line, bool console, struct device *dev)
c4f528795d1add Karthikeyan Ramasubramanian 2018-03-14 261 {
8a8a66a1a18a1d Girish Mahadevan 2018-07-13 262 struct qcom_geni_serial_port *port;
9391ab1ed9b3fe Zong Jiang 2025-08-12 263 int nr_ports = console ? GENI_UART_CONS_PORTS : CONFIG_SERIAL_QCOM_GENI_UART_PORTS;
8a8a66a1a18a1d Girish Mahadevan 2018-07-13 264
a53be6945f5123 Viken Dadhaniya 2025-03-27 265 if (console) {
a53be6945f5123 Viken Dadhaniya 2025-03-27 266 if (line < 0 || line >= nr_ports)
a53be6945f5123 Viken Dadhaniya 2025-03-27 267 return ERR_PTR(-ENXIO);
a53be6945f5123 Viken Dadhaniya 2025-03-27 268
a53be6945f5123 Viken Dadhaniya 2025-03-27 269 port = &qcom_geni_console_port;
a53be6945f5123 Viken Dadhaniya 2025-03-27 270 } else {
a53be6945f5123 Viken Dadhaniya 2025-03-27 271 int max_alias_num = of_alias_get_highest_id("serial");
a53be6945f5123 Viken Dadhaniya 2025-03-27 272
8a8a66a1a18a1d Girish Mahadevan 2018-07-13 273 if (line < 0 || line >= nr_ports)
a53be6945f5123 Viken Dadhaniya 2025-03-27 @274 line = ida_alloc_range(&port_ida, max_alias_num + 1, nr_ports, GFP_KERNEL);
ida_alloc_range() range parameters are inclusive so this should be
ida_alloc_range(&port_ida, max_alias_num + 1, nr_ports - 1, GFP_KERNEL);
a53be6945f5123 Viken Dadhaniya 2025-03-27 275 else
a53be6945f5123 Viken Dadhaniya 2025-03-27 276 line = ida_alloc_range(&port_ida, line, nr_ports, GFP_KERNEL);
same here
a53be6945f5123 Viken Dadhaniya 2025-03-27 277
a53be6945f5123 Viken Dadhaniya 2025-03-27 278 if (line < 0)
c4f528795d1add Karthikeyan Ramasubramanian 2018-03-14 279 return ERR_PTR(-ENXIO);
8a8a66a1a18a1d Girish Mahadevan 2018-07-13 280
c3e7966c60745f Zong Jiang 2025-08-12 281 port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL);
c3e7966c60745f Zong Jiang 2025-08-12 282 if (!port)
c3e7966c60745f Zong Jiang 2025-08-12 283 return ERR_PTR(-ENOMEM);
c3e7966c60745f Zong Jiang 2025-08-12 284
c3e7966c60745f Zong Jiang 2025-08-12 285 port->uport.iotype = UPIO_MEM;
c3e7966c60745f Zong Jiang 2025-08-12 286 port->uport.ops = &qcom_geni_uart_pops;
c3e7966c60745f Zong Jiang 2025-08-12 287 port->uport.flags = UPF_BOOT_AUTOCONF;
c3e7966c60745f Zong Jiang 2025-08-12 288 port->uport.line = line;
a53be6945f5123 Viken Dadhaniya 2025-03-27 289 }
8a8a66a1a18a1d Girish Mahadevan 2018-07-13 290 return port;
c4f528795d1add Karthikeyan Ramasubramanian 2018-03-14 291 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-18 6:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-18 0:35 [tty:tty-testing 8/24] drivers/tty/serial/qcom_geni_serial.c:274 get_port_from_line() error: Calling ida_alloc_range() with a 'max' argument which is a power of 2. -1 missing? kernel test robot
2025-08-18 6:34 ` Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.