]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tty: serial: Modify the use of dev_err_probe()
authorXichao Zhao <zhao.xichao@vivo.com>
Tue, 19 Aug 2025 12:09:27 +0000 (20:09 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Nov 2025 20:34:14 +0000 (15:34 -0500)
[ Upstream commit 706c3c02eecd41dc675e9102b3719661cd3e30e2 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tty/serial/max3100.c
drivers/tty/serial/max310x.c

index cde5f1c86353e32a1a281ffafb08a28dccb63e6c..e0fc010a9b9ff3c47e2de53efe956efd68b6d7b4 100644 (file)
@@ -704,7 +704,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);
index 2f8e3ea4fe12871d2b3e8422b5e50a6a51e5e75d..9850446ae7037b076a93fc0d76dfc21fabc27fdf 100644 (file)
@@ -1266,8 +1266,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);