Commit deef4da8 authored by Cristian Ciocaltea's avatar Cristian Ciocaltea Committed by Mark Brown

spi: amd: Make use of dev_err_probe()

Simplify the error handling in probe function by switching from
dev_err() to dev_err_probe().
Signed-off-by: default avatarCristian Ciocaltea <cristian.ciocaltea@collabora.com>
Link: https://lore.kernel.org/r/20220706100626.1234731-4-cristian.ciocaltea@collabora.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 2e063bb1
...@@ -285,18 +285,15 @@ static int amd_spi_probe(struct platform_device *pdev) ...@@ -285,18 +285,15 @@ static int amd_spi_probe(struct platform_device *pdev)
/* Allocate storage for spi_master and driver private data */ /* Allocate storage for spi_master and driver private data */
master = devm_spi_alloc_master(dev, sizeof(struct amd_spi)); master = devm_spi_alloc_master(dev, sizeof(struct amd_spi));
if (!master) { if (!master)
dev_err(dev, "Error allocating SPI master\n"); return dev_err_probe(dev, -ENOMEM, "Error allocating SPI master\n");
return -ENOMEM;
}
amd_spi = spi_master_get_devdata(master); amd_spi = spi_master_get_devdata(master);
amd_spi->io_remap_addr = devm_platform_ioremap_resource(pdev, 0); amd_spi->io_remap_addr = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(amd_spi->io_remap_addr)) { if (IS_ERR(amd_spi->io_remap_addr))
err = PTR_ERR(amd_spi->io_remap_addr); return dev_err_probe(dev, PTR_ERR(amd_spi->io_remap_addr),
dev_err(dev, "error %d ioremap of SPI registers failed\n", err); "ioremap of SPI registers failed\n");
return err;
}
dev_dbg(dev, "io_remap_address: %p\n", amd_spi->io_remap_addr); dev_dbg(dev, "io_remap_address: %p\n", amd_spi->io_remap_addr);
amd_spi->version = (enum amd_spi_versions) device_get_match_data(dev); amd_spi->version = (enum amd_spi_versions) device_get_match_data(dev);
...@@ -314,9 +311,9 @@ static int amd_spi_probe(struct platform_device *pdev) ...@@ -314,9 +311,9 @@ static int amd_spi_probe(struct platform_device *pdev)
/* Register the controller with SPI framework */ /* Register the controller with SPI framework */
err = devm_spi_register_master(dev, master); err = devm_spi_register_master(dev, master);
if (err) if (err)
dev_err(dev, "error %d registering SPI controller\n", err); return dev_err_probe(dev, err, "error registering SPI controller\n");
return err; return 0;
} }
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment