Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'spi-fix-v7.0-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi fixes from Mark Brown:
"A small collection of fixes, mostly probe/remove issues that are the
result of Felix Gu going and auditing those areas, plus one error
handling fix for the Cadence QSPI driver"

* tag 'spi-fix-v7.0-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
spi: cadence-qspi: Fix exec_mem_op error handling
spi: amlogic: spifc-a4: unregister ECC engine on probe failure and remove() callback
spi: stm32-ospi: Fix DMA channel leak on stm32_ospi_dma_setup() failure
spi: stm32-ospi: Fix reset control leak on probe error
spi: stm32-ospi: Fix resource leak in remove() callback

+27 -14
+12
drivers/spi/spi-amlogic-spifc-a4.c
··· 1066 1066 .finish_io_req = aml_sfc_ecc_finish_io_req, 1067 1067 }; 1068 1068 1069 + static void aml_sfc_unregister_ecc_engine(void *data) 1070 + { 1071 + struct nand_ecc_engine *eng = data; 1072 + 1073 + nand_ecc_unregister_on_host_hw_engine(eng); 1074 + } 1075 + 1069 1076 static int aml_sfc_clk_init(struct aml_sfc *sfc) 1070 1077 { 1071 1078 sfc->gate_clk = devm_clk_get_enabled(sfc->dev, "gate"); ··· 1155 1148 ret = nand_ecc_register_on_host_hw_engine(&sfc->ecc_eng); 1156 1149 if (ret) 1157 1150 return dev_err_probe(&pdev->dev, ret, "failed to register Aml host ecc engine.\n"); 1151 + 1152 + ret = devm_add_action_or_reset(dev, aml_sfc_unregister_ecc_engine, 1153 + &sfc->ecc_eng); 1154 + if (ret) 1155 + return dev_err_probe(dev, ret, "failed to add ECC unregister action\n"); 1158 1156 1159 1157 ret = of_property_read_u32(np, "amlogic,rx-adj", &val); 1160 1158 if (!ret)
+9 -8
drivers/spi/spi-cadence-quadspi.c
··· 1483 1483 if (refcount_read(&cqspi->inflight_ops) == 0) 1484 1484 return -ENODEV; 1485 1485 1486 - if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) { 1487 - ret = pm_runtime_resume_and_get(dev); 1488 - if (ret) { 1489 - dev_err(&mem->spi->dev, "resume failed with %d\n", ret); 1490 - return ret; 1491 - } 1492 - } 1493 - 1494 1486 if (!refcount_read(&cqspi->refcount)) 1495 1487 return -EBUSY; 1496 1488 ··· 1494 1502 return -EBUSY; 1495 1503 } 1496 1504 1505 + if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) { 1506 + ret = pm_runtime_resume_and_get(dev); 1507 + if (ret) { 1508 + dev_err(&mem->spi->dev, "resume failed with %d\n", ret); 1509 + goto dec_inflight_refcount; 1510 + } 1511 + } 1512 + 1497 1513 ret = cqspi_mem_process(mem, op); 1498 1514 1499 1515 if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) ··· 1510 1510 if (ret) 1511 1511 dev_err(&mem->spi->dev, "operation failed with %d\n", ret); 1512 1512 1513 + dec_inflight_refcount: 1513 1514 if (refcount_read(&cqspi->inflight_ops) > 1) 1514 1515 refcount_dec(&cqspi->inflight_ops); 1515 1516
+6 -6
drivers/spi/spi-stm32-ospi.c
··· 928 928 dma_cfg.dst_addr = ospi->regs_phys_base + OSPI_DR; 929 929 ret = stm32_ospi_dma_setup(ospi, &dma_cfg); 930 930 if (ret) 931 - return ret; 931 + goto err_dma_free; 932 932 933 933 mutex_init(&ospi->lock); 934 934 ··· 965 965 if (ret) { 966 966 /* Disable ospi */ 967 967 writel_relaxed(0, ospi->regs_base + OSPI_CR); 968 - goto err_pm_resume; 968 + goto err_reset_control; 969 969 } 970 970 971 971 pm_runtime_put_autosuspend(ospi->dev); 972 972 973 973 return 0; 974 974 975 + err_reset_control: 976 + reset_control_release(ospi->rstc); 975 977 err_pm_resume: 976 978 pm_runtime_put_sync_suspend(ospi->dev); 977 979 978 980 err_pm_enable: 979 981 pm_runtime_force_suspend(ospi->dev); 980 982 mutex_destroy(&ospi->lock); 983 + err_dma_free: 981 984 if (ospi->dma_chtx) 982 985 dma_release_channel(ospi->dma_chtx); 983 986 if (ospi->dma_chrx) ··· 992 989 static void stm32_ospi_remove(struct platform_device *pdev) 993 990 { 994 991 struct stm32_ospi *ospi = platform_get_drvdata(pdev); 995 - int ret; 996 992 997 - ret = pm_runtime_resume_and_get(ospi->dev); 998 - if (ret < 0) 999 - return; 993 + pm_runtime_resume_and_get(ospi->dev); 1000 994 1001 995 spi_unregister_controller(ospi->ctrl); 1002 996 /* Disable ospi */