spi: amlogic: spifc-a4: unregister ECC engine on probe failure and remove() callback
aml_sfc_probe() registers the on-host NAND ECC engine, but teardown was
missing from both probe unwind and remove-time cleanup. Add a devm cleanup
action after successful registration so
nand_ecc_unregister_on_host_hw_engine() runs automatically on probe
failures and during device removal.
Fixes: 4670db6f32 ("spi: amlogic: add driver for Amlogic SPI Flash Controller")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Link: https://patch.msgid.link/20260322-spifc-a4-v1-1-2dc5ebcbe0a9@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
534025950c
commit
b0dc7e7c56
1 changed files with 12 additions and 0 deletions
|
|
@ -1066,6 +1066,13 @@ static const struct nand_ecc_engine_ops aml_sfc_ecc_engine_ops = {
|
|||
.finish_io_req = aml_sfc_ecc_finish_io_req,
|
||||
};
|
||||
|
||||
static void aml_sfc_unregister_ecc_engine(void *data)
|
||||
{
|
||||
struct nand_ecc_engine *eng = data;
|
||||
|
||||
nand_ecc_unregister_on_host_hw_engine(eng);
|
||||
}
|
||||
|
||||
static int aml_sfc_clk_init(struct aml_sfc *sfc)
|
||||
{
|
||||
sfc->gate_clk = devm_clk_get_enabled(sfc->dev, "gate");
|
||||
|
|
@ -1149,6 +1156,11 @@ static int aml_sfc_probe(struct platform_device *pdev)
|
|||
if (ret)
|
||||
return dev_err_probe(&pdev->dev, ret, "failed to register Aml host ecc engine.\n");
|
||||
|
||||
ret = devm_add_action_or_reset(dev, aml_sfc_unregister_ecc_engine,
|
||||
&sfc->ecc_eng);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "failed to add ECC unregister action\n");
|
||||
|
||||
ret = of_property_read_u32(np, "amlogic,rx-adj", &val);
|
||||
if (!ret)
|
||||
sfc->rx_adj = val;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue