[PATCH v2 3/6] spi: microchip-core: Replace dead code (-ENOMEM error message)

Andy Shevchenko posted 6 patches 5 days, 15 hours ago
There is a newer version of this series
[PATCH v2 3/6] spi: microchip-core: Replace dead code (-ENOMEM error message)
Posted by Andy Shevchenko 5 days, 15 hours ago
First of all, the convention in the kernel that we do not issue
error messages for -ENOMEM. Second, it's ignored by dev_err_probe().
Replace dead code by a simple return statement.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/spi/spi-microchip-core-spi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/spi/spi-microchip-core-spi.c b/drivers/spi/spi-microchip-core-spi.c
index f8184b711272..8ea382c6fee7 100644
--- a/drivers/spi/spi-microchip-core-spi.c
+++ b/drivers/spi/spi-microchip-core-spi.c
@@ -293,8 +293,7 @@ static int mchp_corespi_probe(struct platform_device *pdev)
 
 	host = devm_spi_alloc_host(&pdev->dev, sizeof(*spi));
 	if (!host)
-		return dev_err_probe(&pdev->dev, -ENOMEM,
-				     "unable to allocate host for SPI controller\n");
+		return -ENOMEM;
 
 	platform_set_drvdata(pdev, host);
 
-- 
2.50.1
Re: [PATCH v2 3/6] spi: microchip-core: Replace dead code (-ENOMEM error message)
Posted by Prajna Rajendra Kumar 4 days, 7 hours ago
On 26/11/2025 07:54, Andy Shevchenko wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> First of all, the convention in the kernel that we do not issue
> error messages for -ENOMEM. Second, it's ignored by dev_err_probe().
> Replace dead code by a simple return statement.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Prajna Rajendra Kumar <prajna.rajendrakumar@microchip.com>
> ---
>   drivers/spi/spi-microchip-core-spi.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/spi/spi-microchip-core-spi.c b/drivers/spi/spi-microchip-core-spi.c
> index f8184b711272..8ea382c6fee7 100644
> --- a/drivers/spi/spi-microchip-core-spi.c
> +++ b/drivers/spi/spi-microchip-core-spi.c
> @@ -293,8 +293,7 @@ static int mchp_corespi_probe(struct platform_device *pdev)
>
>          host = devm_spi_alloc_host(&pdev->dev, sizeof(*spi));
>          if (!host)
> -               return dev_err_probe(&pdev->dev, -ENOMEM,
> -                                    "unable to allocate host for SPI controller\n");
> +               return -ENOMEM;
>
>          platform_set_drvdata(pdev, host);
>
> --
> 2.50.1
>