Skip to content

Commit 706c3c0

Browse files
Xichao Zhaogregkh
authored andcommitted
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>
1 parent 7cd9f5d commit 706c3c0

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/tty/serial/max3100.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ static int max3100_probe(struct spi_device *spi)
705705
break;
706706
if (i == MAX_MAX3100) {
707707
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");
709709
}
710710

711711
max3100s[i] = kzalloc(sizeof(struct max3100_port), GFP_KERNEL);

drivers/tty/serial/max310x.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,8 +1269,7 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty
12691269
/* Alloc port structure */
12701270
s = devm_kzalloc(dev, struct_size(s, p, devtype->nr), GFP_KERNEL);
12711271
if (!s)
1272-
return dev_err_probe(dev, -ENOMEM,
1273-
"Error allocating port structure\n");
1272+
return -ENOMEM;
12741273

12751274
/* Always ask for fixed clock rate from a property. */
12761275
device_property_read_u32(dev, "clock-frequency", &uartclk);

0 commit comments

Comments
 (0)