diff options
author | Joel Stanley <joel@jms.id.au> | 2019-07-31 12:26:43 +0300 |
---|---|---|
committer | Andrew Geissler <geissonator@yahoo.com> | 2019-08-01 14:54:33 +0300 |
commit | dbf852204a7ca0ce66bc953ee5ced9709cdd8ab0 (patch) | |
tree | 3a85ab20d608f7b048c8f776c680bb6e4420f761 /meta-aspeed/recipes-kernel | |
parent | d4b06e6e16875bc26f656bcab66db7f9f6ebdb15 (diff) | |
download | openbmc-dbf852204a7ca0ce66bc953ee5ced9709cdd8ab0.tar.xz |
linux-aspeed-sdk: Add fix for ESPI crash
This patch has been submitted to aspeed.
(From meta-aspeed rev: d537df871b467808a6ff3f08d596f6d9a2f52dde)
Change-Id: I6d4e68e275c24b3f5bbbf9b1b836ac2a04e5cd4f
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Diffstat (limited to 'meta-aspeed/recipes-kernel')
-rw-r--r-- | meta-aspeed/recipes-kernel/linux/linux-aspeed-sdk/aspeed-g6/0001-aspeed-espi-Clean-up-error-handling.patch | 102 | ||||
-rw-r--r-- | meta-aspeed/recipes-kernel/linux/linux-aspeed-sdk_git.bb | 2 |
2 files changed, 104 insertions, 0 deletions
diff --git a/meta-aspeed/recipes-kernel/linux/linux-aspeed-sdk/aspeed-g6/0001-aspeed-espi-Clean-up-error-handling.patch b/meta-aspeed/recipes-kernel/linux/linux-aspeed-sdk/aspeed-g6/0001-aspeed-espi-Clean-up-error-handling.patch new file mode 100644 index 000000000..8c69abc34 --- /dev/null +++ b/meta-aspeed/recipes-kernel/linux/linux-aspeed-sdk/aspeed-g6/0001-aspeed-espi-Clean-up-error-handling.patch @@ -0,0 +1,102 @@ +From aa808480fb9fa62c96bd38a83328a87971a95ed4 Mon Sep 17 00:00:00 2001 +From: Joel Stanley <joel@jms.id.au> +Date: Wed, 31 Jul 2019 18:10:37 +0930 +Subject: [PATCH] aspeed: espi: Clean up error handling + +I was seeing a crash shortly after the ESPI driver failed to probe: + + AST ESPI Unable to get GPIO IRQ -22 + Trying to free nonexistent resource <000000001e6ee000-000000001e6ee1ff> + aspeed_espi: probe of 1e6ee000.espi failed with error -22 + +The error handling was freeing the unallocated resource. + +The driver correctly makes allocations using the devm APIs. This means +the kernel will handle cleaning up of resources on failure. This patch +removes the unnecessary error handling. + +Signed-off-by: Joel Stanley <joel@jms.id.au> +--- + drivers/soc/aspeed/aspeed-espi.c | 30 ++++++------------------------ + 1 file changed, 6 insertions(+), 24 deletions(-) + +diff --git a/drivers/soc/aspeed/aspeed-espi.c b/drivers/soc/aspeed/aspeed-espi.c +index 342d45bdbad3..2b72f05dd24f 100644 +--- a/drivers/soc/aspeed/aspeed-espi.c ++++ b/drivers/soc/aspeed/aspeed-espi.c +@@ -1284,17 +1284,10 @@ static int aspeed_espi_probe(struct platform_device *pdev) + aspeed_espi->dma_mode = 0; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- if (res == NULL) { +- dev_err(&pdev->dev, "no memory resource defined\n"); +- ret = -ENODEV; +- goto err_free; +- } +- + aspeed_espi->reg_base = devm_ioremap_resource(&pdev->dev, res); +- if (aspeed_espi->reg_base == NULL) { ++ if (IS_ERR(aspeed_espi->reg_base)) { + dev_err(&pdev->dev, "failed to ioremap() registers\n"); +- ret = -ENODEV; +- goto err_free_mem; ++ return ERR_PTR(aspeed_espi->reg_base); + } + + sysfs_bin_attr_init(&aspeed_espi->oob_channel); +@@ -1398,15 +1391,14 @@ static int aspeed_espi_probe(struct platform_device *pdev) + aspeed_espi->irq = platform_get_irq(pdev, 0); + if (aspeed_espi->irq < 0) { + dev_err(&pdev->dev, "no irq specified\n"); +- ret = -ENOENT; +- goto err_free_mem; ++ return aspeed_espi->irq; + } + + ret = devm_request_irq(&pdev->dev, aspeed_espi->irq, aspeed_espi_isr, + 0, dev_name(&pdev->dev), aspeed_espi); + if (ret) { + printk("AST ESPI Unable to get IRQ"); +- goto err_free_mem; ++ return ret; + } + + aspeed_espi->reset = devm_reset_control_get(&pdev->dev, NULL); +@@ -1421,7 +1413,7 @@ static int aspeed_espi_probe(struct platform_device *pdev) + 0, dev_name(&pdev->dev), aspeed_espi); + if (ret) { + printk("AST ESPI Unable to get GPIO IRQ %d\n", ret); +- goto err_free_mem; ++ return ret; + } + + aspeed_espi_ctrl_init(aspeed_espi); +@@ -1429,7 +1421,7 @@ static int aspeed_espi_probe(struct platform_device *pdev) + ret = misc_register(&aspeed_espi_misc); + if (ret) { + printk(KERN_ERR "ESPI : failed misc_register\n"); +- goto err_free_irq; ++ return ret; + } + + platform_set_drvdata(pdev, aspeed_espi); +@@ -1444,16 +1436,6 @@ static int aspeed_espi_probe(struct platform_device *pdev) + printk(KERN_INFO "aspeed_espi: driver successfully loaded.\n"); + + return 0; +- +-err_free_irq: +- free_irq(aspeed_espi->irq, pdev); +- +-err_free_mem: +- release_mem_region(res->start, resource_size(res)); +-err_free: +- kfree(aspeed_espi); +- +- return ret; + } + + static int aspeed_espi_remove(struct platform_device *pdev) +-- +2.20.1 + diff --git a/meta-aspeed/recipes-kernel/linux/linux-aspeed-sdk_git.bb b/meta-aspeed/recipes-kernel/linux/linux-aspeed-sdk_git.bb index 060577172..1ca1ec547 100644 --- a/meta-aspeed/recipes-kernel/linux/linux-aspeed-sdk_git.bb +++ b/meta-aspeed/recipes-kernel/linux/linux-aspeed-sdk_git.bb @@ -6,3 +6,5 @@ SRCREV="466b2520fa3bbedad4da77d3eaad33d3f8838b7f" require linux-aspeed.inc +# This must come after the require line +SRC_URI += "file://0001-aspeed-espi-Clean-up-error-handling.patch" |