mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-08 00:29:36 -04:00
spi: sg2044-nor: A couple of cleanups
Merge series from Andy Shevchenko <andriy.shevchenko@linux.intel.com>: The driver has one ordering issue and one missed case for dev_err_probe(). Address that in this mini-series.
This commit is contained in:
@@ -425,6 +425,7 @@ static void sg2044_spifmc_init(struct sg2044_spifmc *spifmc)
|
||||
|
||||
static int sg2044_spifmc_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct spi_controller *ctrl;
|
||||
struct sg2044_spifmc *spifmc;
|
||||
void __iomem *base;
|
||||
@@ -435,13 +436,10 @@ static int sg2044_spifmc_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
|
||||
spifmc = spi_controller_get_devdata(ctrl);
|
||||
dev_set_drvdata(&pdev->dev, ctrl);
|
||||
|
||||
spifmc->clk = devm_clk_get_enabled(&pdev->dev, NULL);
|
||||
if (IS_ERR(spifmc->clk))
|
||||
return dev_err_probe(&pdev->dev, PTR_ERR(spifmc->clk),
|
||||
"%s: Cannot get and enable AHB clock\n",
|
||||
__func__);
|
||||
return dev_err_probe(dev, PTR_ERR(spifmc->clk), "Cannot get and enable AHB clock\n");
|
||||
|
||||
spifmc->dev = &pdev->dev;
|
||||
spifmc->ctrl = ctrl;
|
||||
@@ -457,28 +455,20 @@ static int sg2044_spifmc_probe(struct platform_device *pdev)
|
||||
ctrl->mem_ops = &sg2044_spifmc_mem_ops;
|
||||
ctrl->mode_bits = SPI_RX_DUAL | SPI_TX_DUAL | SPI_RX_QUAD | SPI_TX_QUAD;
|
||||
|
||||
mutex_init(&spifmc->lock);
|
||||
ret = devm_mutex_init(dev, &spifmc->lock);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
sg2044_spifmc_init(spifmc);
|
||||
sg2044_spifmc_init_reg(spifmc);
|
||||
|
||||
ret = devm_spi_register_controller(&pdev->dev, ctrl);
|
||||
if (ret) {
|
||||
mutex_destroy(&spifmc->lock);
|
||||
dev_err(&pdev->dev, "spi_register_controller failed\n");
|
||||
return ret;
|
||||
}
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "spi_register_controller failed\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sg2044_spifmc_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct sg2044_spifmc *spifmc = platform_get_drvdata(pdev);
|
||||
|
||||
mutex_destroy(&spifmc->lock);
|
||||
}
|
||||
|
||||
static const struct of_device_id sg2044_spifmc_match[] = {
|
||||
{ .compatible = "sophgo,sg2044-spifmc-nor" },
|
||||
{ /* sentinel */ }
|
||||
@@ -491,7 +481,6 @@ static struct platform_driver sg2044_nor_driver = {
|
||||
.of_match_table = sg2044_spifmc_match,
|
||||
},
|
||||
.probe = sg2044_spifmc_probe,
|
||||
.remove = sg2044_spifmc_remove,
|
||||
};
|
||||
module_platform_driver(sg2044_nor_driver);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user