Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tty: serial: Modify the use of dev_err_probe()

The dev_err_probe() doesn't do anything when error is '-ENOMEM'.
Make the following two changes:
(1) Replace -ENOMEM with -ENOSPC in max3100_probe().
(2) Just return -ENOMEM instead in max310x_probe().

Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20250819120927.607744-1-zhao.xichao@vivo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Xichao Zhao and committed by
Greg Kroah-Hartman
706c3c02 7cd9f5d6

+2 -3
+1 -1
drivers/tty/serial/max3100.c
··· 705 705 break; 706 706 if (i == MAX_MAX3100) { 707 707 mutex_unlock(&max3100s_lock); 708 - return dev_err_probe(dev, -ENOMEM, "too many MAX3100 chips\n"); 708 + return dev_err_probe(dev, -ENOSPC, "too many MAX3100 chips\n"); 709 709 } 710 710 711 711 max3100s[i] = kzalloc(sizeof(struct max3100_port), GFP_KERNEL);
+1 -2
drivers/tty/serial/max310x.c
··· 1269 1269 /* Alloc port structure */ 1270 1270 s = devm_kzalloc(dev, struct_size(s, p, devtype->nr), GFP_KERNEL); 1271 1271 if (!s) 1272 - return dev_err_probe(dev, -ENOMEM, 1273 - "Error allocating port structure\n"); 1272 + return -ENOMEM; 1274 1273 1275 1274 /* Always ask for fixed clock rate from a property. */ 1276 1275 device_property_read_u32(dev, "clock-frequency", &uartclk);