Commit 706c3c02 authored by Xichao Zhao's avatar Xichao Zhao Committed by Greg Kroah-Hartman
Browse files

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: default avatarXichao Zhao <zhao.xichao@vivo.com>
Reviewed-by: default avatarJiri Slaby <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20250819120927.607744-1-zhao.xichao@vivo.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7cd9f5d6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -705,7 +705,7 @@ static int max3100_probe(struct spi_device *spi)
			break;
	if (i == MAX_MAX3100) {
		mutex_unlock(&max3100s_lock);
		return dev_err_probe(dev, -ENOMEM, "too many MAX3100 chips\n");
		return dev_err_probe(dev, -ENOSPC, "too many MAX3100 chips\n");
	}

	max3100s[i] = kzalloc(sizeof(struct max3100_port), GFP_KERNEL);
+1 −2
Original line number Diff line number Diff line
@@ -1269,8 +1269,7 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty
	/* Alloc port structure */
	s = devm_kzalloc(dev, struct_size(s, p, devtype->nr), GFP_KERNEL);
	if (!s)
		return dev_err_probe(dev, -ENOMEM,
				     "Error allocating port structure\n");
		return -ENOMEM;

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