dmaengine: fsl_raid: fix resource leaks and simplify drvdata handling
v2 cover dmaengine: fsl_raid: fix resource leaks and simplify drvdata handling
This series fixes resource leaks in the FSL RAIDEngine driver and simplifies drvdata handling:
1) Replace dev_get_drvdata/dev_set_drvdata with platform_get_drvdata/ platform_set_drvdata, since a platform_device is always used. This avoids taking a pointer to a platform device member.
2) Add missing free_irq() in error unwind of fsl_re_chan_probe() and in fsl_re_remove_chan(). Also add tasklet_kill() and of_platform_device_destroy() to properly release all resources.
v2: split into two patches
Rosen Penev (2):
dmaengine: fsl_raid: pass platform_device to drvdata
dmaengine: fsl_raid: free resources in probe
drivers/dma/fsl_raid.c | 33 ++++++++++++++++++++------------- drivers/dma/fsl_raid.h | 1 + 2 files changed, 21 insertions(+), 13 deletions(-)
Signature · 1 line
2.55.0
PATCH v2 1/2 dmaengine: fsl_raid: pass platform_device to drvdata
Simplifies code slightly and avoids having to take pointer of a platform device member. A platform device is always used.
--- drivers/dma/fsl_raid.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/dma/fsl_raid.c +7 -8
@@ -219,10 +219,11 @@ static void fsl_re_dequeue(struct tasklet_struct *t)/* Per Job Ring interrupt handler */ static irqreturn_t fsl_re_isr (int irq,void *data) { +struct platform_device *pdev = data;struct fsl_re_chan *re_chan;u32 irqstate, status; - re_chan =dev_get_drvdata ((struct device *)data); + re_chan =platform_get_drvdata (pdev); irqstate =in_be32 (&re_chan->jrregs->jr_interrupt_status);if (!irqstate)
@@ -649,7 +650,7 @@ static int fsl_re_chan_probe(struct platform_device *ofdev,struct platform_device *chan_ofdev; dev = &ofdev->dev; - re_priv =dev_get_drvdata (dev); + re_priv =platform_get_drvdata (ofdev); dma_dev = &re_priv->dma_dev; chan =devm_kzalloc (dev,sizeof (*chan),GFP_KERNEL );
@@ -687,7 +688,7 @@ static int fsl_re_chan_probe(struct platform_device *ofdev, chandev = &chan_ofdev->dev;tasklet_setup (&chan->irqtask, fsl_re_dequeue); - ret =request_irq (chan->irq, fsl_re_isr,0 , chan->name, chandev); + ret =request_irq (chan->irq, fsl_re_isr,0 , chan->name, chan_ofdev);if (ret) {dev_err (dev,"Unable to register interrupt for JR %d\n" , q); ret = -EINVAL ;
@@ -743,7 +744,7 @@ static int fsl_re_chan_probe(struct platform_device *ofdev,out_be32 (&chan->jrregs->jr_config_1,FSL_RE_CFG1_CBSI |FSL_RE_CFG1_CBS0 | status); -dev_set_drvdata (chandev, chan); +platform_set_drvdata (chan_ofdev, chan);/* Enable RE/CHAN */ out_be32 (&chan->jrregs->jr_command,FSL_RE_ENABLE );
@@ -834,7 +835,7 @@ static int fsl_re_probe(struct platform_device *ofdev)return -ENOMEM ; } -dev_set_drvdata (dev, re_priv); +platform_set_drvdata (ofdev, re_priv);/* Parse Device tree to find out the total number of JQs present */ for_each_compatible_node_scoped (np,NULL ,"fsl,raideng-v1.0-job-queue" ) {
@@ -903,11 +904,9 @@ static void fsl_re_remove_chan(struct fsl_re_chan *chan)static void fsl_re_remove (struct platform_device *ofdev) {struct fsl_re_drv_private *re_priv; -struct device *dev;int i; - dev = &ofdev->dev; - re_priv =dev_get_drvdata (dev); + re_priv =platform_get_drvdata (ofdev);/* Unregister the DMA device first so no client can still hold a * channel and submit new work while the channel rings are torn
Signature · 1 line
2.55.0
Re: [PATCHv2 1/2] dmaengine: fsl_raid: pass platform_device to drvdata
Quoted 5 lines · Rosen Penev
Simplifies code slightly and avoids having to take pointer of a platform device member. A platform device is always used.
Signed-off-by Rosen Penev <[email protected]>---
Quoted 72 lines
drivers/dma/fsl_raid.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)drivers/dma/fsl_raid.c +7
-9@@ -219,10 +219,11 @@ static void fsl_re_dequeue(struct tasklet_struct *t)/* Per Job Ring interrupt handler */ static irqreturn_t fsl_re_isr (int irq,void *data) { +struct platform_device *pdev = data;struct fsl_re_chan *re_chan;u32 irqstate, status; - re_chan =dev_get_drvdata ((struct device *)data); + re_chan =platform_get_drvdata (pdev); irqstate =in_be32 (&re_chan->jrregs->jr_interrupt_status);if (!irqstate)@@ -649,7 +650,7 @@ static int fsl_re_chan_probe(struct platform_device *ofdev,struct platform_device *chan_ofdev; dev = &ofdev->dev; - re_priv =dev_get_drvdata (dev); + re_priv =platform_get_drvdata (ofdev); dma_dev = &re_priv->dma_dev; chan =devm_kzalloc (dev,sizeof (*chan),GFP_KERNEL );@@ -687,7 +688,7 @@ static int fsl_re_chan_probe(struct platform_device *ofdev, chandev = &chan_ofdev->dev;tasklet_setup (&chan->irqtask, fsl_re_dequeue); - ret =request_irq (chan->irq, fsl_re_isr,0 , chan->name, chandev); + ret =request_irq (chan->irq, fsl_re_isr,0 , chan->name, chan_ofdev);if (ret) {dev_err (dev,"Unable to register interrupt for JR %d\n" , q); ret = -EINVAL ;@@ -743,7 +744,7 @@ static int fsl_re_chan_probe(struct platform_device *ofdev,out_be32 (&chan->jrregs->jr_config_1,FSL_RE_CFG1_CBSI |FSL_RE_CFG1_CBS0 | status); -dev_set_drvdata (chandev, chan); +platform_set_drvdata (chan_ofdev, chan);/* Enable RE/CHAN */ out_be32 (&chan->jrregs->jr_command,FSL_RE_ENABLE );@@ -834,7 +835,7 @@ static int fsl_re_probe(struct platform_device *ofdev)return -ENOMEM ; } -dev_set_drvdata (dev, re_priv); +platform_set_drvdata (ofdev, re_priv);/* Parse Device tree to find out the total number of JQs present */ for_each_compatible_node_scoped (np,NULL ,"fsl,raideng-v1.0-job-queue" ) {@@ -903,11 +904,9 @@ static void fsl_re_remove_chan(struct fsl_re_chan *chan)static void fsl_re_remove (struct platform_device *ofdev) {struct fsl_re_drv_private *re_priv; -struct device *dev;int i; - dev = &ofdev->dev; - re_priv =dev_get_drvdata (dev); + re_priv =platform_get_drvdata (ofdev);/* Unregister the DMA device first so no client can still hold a * channel and submit new work while the channel rings are torn -- 2.55.0
PATCH v2 2/2 dmaengine: fsl_raid: free resources in probe
In reply to Rosen PenevAdd free_irq() in the error unwind of fsl_re_chan_probe() and in fsl_re_remove_chan() so the interrupt is always released.
Also add tasklet_kill(). Present in _remove but not _probe.
Also add platform_device_put on failure as of_platform_device_create() increases the reference count and needs platform_device_put on failure. Requires placing the pointer in the struct for the _remove function. While at it, use platform_get/set_drvdata as there's no need for using a device pointer for that.
--- drivers/dma/fsl_raid.c | 20 ++++++++++++++------ drivers/dma/fsl_raid.h | 1 + 2 files changed, 15 insertions(+), 6 deletions(-)
drivers/dma/fsl_raid.c +14 -6
@@ -661,8 +661,7 @@ static int fsl_re_chan_probe(struct platform_device *ofdev, chan_ofdev =of_platform_device_create (np,NULL , dev);if (!chan_ofdev) {dev_err (dev,"Not able to create ofdev for jr %d\n" , q); - ret = -EINVAL ; - goto err_free; +return -EINVAL ; }/* read reg property from dts */
@@ -688,17 +687,19 @@ static int fsl_re_chan_probe(struct platform_device *ofdev, chandev = &chan_ofdev->dev;tasklet_setup (&chan->irqtask, fsl_re_dequeue); +platform_set_drvdata (chan_ofdev, chan); ret =request_irq (chan->irq, fsl_re_isr,0 , chan->name, chan_ofdev);if (ret) {dev_err (dev,"Unable to register interrupt for JR %d\n" , q); ret = -EINVAL ; - goto err_free; + goto err_free_tasklet; } re_priv->re_jrs[q] = chan; chan->chan.device = dma_dev; chan->chan.private = chan; chan->dev = chandev; + chan->ofdev = chan_ofdev; chan->re_dev = re_priv;spin_lock_init (&chan->desc_lock);
@@ -712,7 +713,7 @@ static int fsl_re_chan_probe(struct platform_device *ofdev,if (!chan->inb_ring_virt_addr) {dev_err (dev,"No dma memory for inb_ring_virt_addr\n" ); ret = -ENOMEM ; - goto err_free; + goto err_free_irq; } chan->oub_ring_virt_addr = dma_pool_alloc(chan->re_dev->hw_desc_pool,
@@ -744,8 +745,6 @@ static int fsl_re_chan_probe(struct platform_device *ofdev,out_be32 (&chan->jrregs->jr_config_1,FSL_RE_CFG1_CBSI |FSL_RE_CFG1_CBS0 | status); -platform_set_drvdata (chan_ofdev, chan); -/* Enable RE/CHAN */ out_be32 (&chan->jrregs->jr_command,FSL_RE_ENABLE );
@@ -754,7 +753,12 @@ static int fsl_re_chan_probe(struct platform_device *ofdev, err_free_1:dma_pool_free (chan->re_dev->hw_desc_pool, chan->inb_ring_virt_addr, chan->inb_phys_addr); +err_free_irq: +free_irq (chan->irq, chan_ofdev); +err_free_tasklet: +tasklet_kill (&chan->irqtask); err_free: +of_platform_device_destroy (chan_ofdev);return ret; }
@@ -892,6 +896,8 @@ static int fsl_re_probe(struct platform_device *ofdev)static void fsl_re_remove_chan (struct fsl_re_chan *chan) { +free_irq (chan->irq, chan->ofdev); +tasklet_kill (&chan->irqtask); dma_pool_free(chan->re_dev->hw_desc_pool, chan->inb_ring_virt_addr,
@@ -899,6 +905,8 @@ static void fsl_re_remove_chan(struct fsl_re_chan *chan)dma_pool_free (chan->re_dev->hw_desc_pool, chan->oub_ring_virt_addr, chan->oub_phys_addr); + +of_platform_device_destroy (chan->ofdev); }static void fsl_re_remove (struct platform_device *ofdev)
drivers/dma/fsl_raid.h +1 -0
@@ -270,6 +270,7 @@ struct fsl_re_chan {struct list_head active_q;/* already issued on hw, not completed */ struct list_head submit_q;struct list_head free_q;/* alloc available queue */ +struct platform_device *ofdev;struct device *dev;struct fsl_re_drv_private *re_dev;struct dma_chan chan;
Signature · 1 line
2.55.0
Re: [PATCHv2 2/2] dmaengine: fsl_raid: free resources in probe
Quoted 34 lines · Rosen Penev
Add
free_irq()in the error unwind offsl_re_chan_probe()and infsl_re_remove_chan()so the interrupt is always released.Also add
tasklet_kill(). Present in_removebut not_probe.Also add
platform_device_puton failure asof_platform_device_create()increases the reference count and needsplatform_device_puton failure. Requires placing the pointer in the struct for the_removefunction. While at it, use platform_get/set_drvdata as there's no need for using a device pointer for that.Fixes ad80da658bbc ("dmaengine: Driver support for FSL RaidEngine device.")Assisted-by opencode:hy3-freeSigned-off-by Rosen Penev <[email protected]>--- drivers/dma/fsl_raid.c | 20 ++++++++++++++------ drivers/dma/fsl_raid.h | 1 + 2 files changed, 15 insertions(+), 6 deletions(-)drivers/dma/fsl_raid.c +1
-2@@ -661,8 +661,7 @@ static int fsl_re_chan_probe(struct platform_device *ofdev, chan_ofdev =of_platform_device_create (np,NULL , dev);if (!chan_ofdev) {dev_err (dev,"Not able to create ofdev for jr %d\n" , q); - ret = -EINVAL ; - goto err_free; +return -EINVAL ; }/* read reg property from dts */
drivers/dma/fsl_raid.c static int fsl_re_chan_probe(struct platform_device *ofdev, · line 690
Quoted 4 lines
drivers/dma/fsl_raid.c +1
-0@@ -688,17 +687,19 @@ static int fsl_re_chan_probe(struct platform_device *ofdev, chandev = &chan_ofdev->dev;tasklet_setup (&chan->irqtask, fsl_re_dequeue); +platform_set_drvdata (chan_ofdev, chan);
Previous patch already set, why need set again?
Frank
Quoted 80 lines
drivers/dma/fsl_raid.c +12
-4ret =request_irq (chan->irq, fsl_re_isr,0 , chan->name, chan_ofdev);if (ret) {dev_err (dev,"Unable to register interrupt for JR %d\n" , q); ret = -EINVAL ; - goto err_free; + goto err_free_tasklet; } re_priv->re_jrs[q] = chan; chan->chan.device = dma_dev; chan->chan.private = chan; chan->dev = chandev; + chan->ofdev = chan_ofdev; chan->re_dev = re_priv;spin_lock_init (&chan->desc_lock);@@ -712,7 +713,7 @@ static int fsl_re_chan_probe(struct platform_device *ofdev,if (!chan->inb_ring_virt_addr) {dev_err (dev,"No dma memory for inb_ring_virt_addr\n" ); ret = -ENOMEM ; - goto err_free; + goto err_free_irq; } chan->oub_ring_virt_addr = dma_pool_alloc(chan->re_dev->hw_desc_pool,@@ -744,8 +745,6 @@ static int fsl_re_chan_probe(struct platform_device *ofdev,out_be32 (&chan->jrregs->jr_config_1,FSL_RE_CFG1_CBSI |FSL_RE_CFG1_CBS0 | status); -platform_set_drvdata (chan_ofdev, chan); -/* Enable RE/CHAN */ out_be32 (&chan->jrregs->jr_command,FSL_RE_ENABLE );@@ -754,7 +753,12 @@ static int fsl_re_chan_probe(struct platform_device *ofdev, err_free_1:dma_pool_free (chan->re_dev->hw_desc_pool, chan->inb_ring_virt_addr, chan->inb_phys_addr); +err_free_irq: +free_irq (chan->irq, chan_ofdev); +err_free_tasklet: +tasklet_kill (&chan->irqtask); err_free: +of_platform_device_destroy (chan_ofdev);return ret; }@@ -892,6 +896,8 @@ static int fsl_re_probe(struct platform_device *ofdev)static void fsl_re_remove_chan (struct fsl_re_chan *chan) { +free_irq (chan->irq, chan->ofdev); +tasklet_kill (&chan->irqtask); dma_pool_free(chan->re_dev->hw_desc_pool, chan->inb_ring_virt_addr,@@ -899,6 +905,8 @@ static void fsl_re_remove_chan(struct fsl_re_chan *chan)dma_pool_free (chan->re_dev->hw_desc_pool, chan->oub_ring_virt_addr, chan->oub_phys_addr); + +of_platform_device_destroy (chan->ofdev); }static void fsl_re_remove (struct platform_device *ofdev)drivers/dma/fsl_raid.h +1
-1@@ -270,6 +270,7 @@ struct fsl_re_chan {struct list_head active_q;/* already issued on hw, not completed */ struct list_head submit_q;struct list_head free_q;/* alloc available queue */ +struct platform_device *ofdev;struct device *dev;struct fsl_re_drv_private *re_dev;struct dma_chan chan; --2.55.0
Re: [PATCHv2 2/2] dmaengine: fsl_raid: free resources in probe
Quoted 34 lines · Frank Li
Quoted 32 lines · Rosen Penev
Add
free_irq()in the error unwind offsl_re_chan_probe()and infsl_re_remove_chan()so the interrupt is always released.Also add
tasklet_kill(). Present in_removebut not_probe.Also add
platform_device_puton failure asof_platform_device_create()increases the reference count and needsplatform_device_puton failure. Requires placing the pointer in the struct for the_removefunction. While at it, use platform_get/set_drvdata as there's no need for using a device pointer for that.Fixes ad80da658bbc ("dmaengine: Driver support for FSL RaidEngine device.")Assisted-by opencode:hy3-freeSigned-off-by Rosen Penev <[email protected]>--- drivers/dma/fsl_raid.c | 20 ++++++++++++++------ drivers/dma/fsl_raid.h | 1 + 2 files changed, 15 insertions(+), 6 deletions(-)drivers/dma/fsl_raid.c +1
-2@@ -661,8 +661,7 @@ static int fsl_re_chan_probe(struct platform_device *ofdev, chan_ofdev =of_platform_device_create (np,NULL , dev);if (!chan_ofdev) {dev_err (dev,"Not able to create ofdev for jr %d\n" , q); - ret = -EINVAL ; - goto err_free; +return -EINVAL ; }
Quoted 8 lines
drivers/dma/fsl_raid.c static int fsl_re_chan_probe(struct platform_device *ofdev, · line 690
Quoted 6 lines
drivers/dma/fsl_raid.c +1
-0/* read reg property from dts */ @@ -688,17 +687,19 @@ static int fsl_re_chan_probe(struct platform_device *ofdev, chandev = &chan_ofdev->dev;tasklet_setup (&chan->irqtask, fsl_re_dequeue); +platform_set_drvdata (chan_ofdev, chan);Previous patch already set, why need set again?
This is because request_irq uses platform_get_drvdata.
On further review, I think chan should be passed directly.
Quoted 82 lines
Frank
Quoted 80 lines
drivers/dma/fsl_raid.c +12
-4ret =request_irq (chan->irq, fsl_re_isr,0 , chan->name, chan_ofdev);if (ret) {dev_err (dev,"Unable to register interrupt for JR %d\n" , q); ret = -EINVAL ; - goto err_free; + goto err_free_tasklet; } re_priv->re_jrs[q] = chan; chan->chan.device = dma_dev; chan->chan.private = chan; chan->dev = chandev; + chan->ofdev = chan_ofdev; chan->re_dev = re_priv;spin_lock_init (&chan->desc_lock);@@ -712,7 +713,7 @@ static int fsl_re_chan_probe(struct platform_device *ofdev,if (!chan->inb_ring_virt_addr) {dev_err (dev,"No dma memory for inb_ring_virt_addr\n" ); ret = -ENOMEM ; - goto err_free; + goto err_free_irq; } chan->oub_ring_virt_addr = dma_pool_alloc(chan->re_dev->hw_desc_pool,@@ -744,8 +745,6 @@ static int fsl_re_chan_probe(struct platform_device *ofdev,out_be32 (&chan->jrregs->jr_config_1,FSL_RE_CFG1_CBSI |FSL_RE_CFG1_CBS0 | status); -platform_set_drvdata (chan_ofdev, chan); -/* Enable RE/CHAN */ out_be32 (&chan->jrregs->jr_command,FSL_RE_ENABLE );@@ -754,7 +753,12 @@ static int fsl_re_chan_probe(struct platform_device *ofdev, err_free_1:dma_pool_free (chan->re_dev->hw_desc_pool, chan->inb_ring_virt_addr, chan->inb_phys_addr); +err_free_irq: +free_irq (chan->irq, chan_ofdev); +err_free_tasklet: +tasklet_kill (&chan->irqtask); err_free: +of_platform_device_destroy (chan_ofdev);return ret; }@@ -892,6 +896,8 @@ static int fsl_re_probe(struct platform_device *ofdev)static void fsl_re_remove_chan (struct fsl_re_chan *chan) { +free_irq (chan->irq, chan->ofdev); +tasklet_kill (&chan->irqtask); dma_pool_free(chan->re_dev->hw_desc_pool, chan->inb_ring_virt_addr,@@ -899,6 +905,8 @@ static void fsl_re_remove_chan(struct fsl_re_chan *chan)dma_pool_free (chan->re_dev->hw_desc_pool, chan->oub_ring_virt_addr, chan->oub_phys_addr); + +of_platform_device_destroy (chan->ofdev); }static void fsl_re_remove (struct platform_device *ofdev)drivers/dma/fsl_raid.h +1
-1@@ -270,6 +270,7 @@ struct fsl_re_chan {struct list_head active_q;/* already issued on hw, not completed */ struct list_head submit_q;struct list_head free_q;/* alloc available queue */ +struct platform_device *ofdev;struct device *dev;struct fsl_re_drv_private *re_dev;struct dma_chan chan; --2.55.0
Re: [PATCHv2 2/2] dmaengine: fsl_raid: free resources in probe
Quoted 9 lines · Rosen Penev
Quoted 8 lines · Frank Li
Quoted 6 lines · Rosen Penev
Add
free_irq()in the error unwind offsl_re_chan_probe()and infsl_re_remove_chan()so the interrupt is always released.Also add
tasklet_kill(). Present in_removebut not_probe.Also add
platform_device_puton failure asof_platform_device_create()
platform_device_put()
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
increases the reference count and needs
platform_device_puton failure. Requires placing the pointer in the struct for the_removefunction. While at it, use platform_get/set_drvdata as there's no need for using a device pointer for that.
Needn't "While at ..."
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
Fixes ad80da658bbc ("dmaengine: Driver support for FSL RaidEngine device.")Assisted-by opencode:hy3-freeSigned-off-by Rosen Penev <[email protected]>--- drivers/dma/fsl_raid.c | 20 ++++++++++++++------ drivers/dma/fsl_raid.h | 1 + 2 files changed, 15 insertions(+), 6 deletions(-)drivers/dma/fsl_raid.c +1
-2@@ -661,8 +661,7 @@ static int fsl_re_chan_probe(struct platform_device *ofdev, chan_ofdev =of_platform_device_create (np,NULL , dev);if (!chan_ofdev) {dev_err (dev,"Not able to create ofdev for jr %d\n" , q); - ret = -EINVAL ; - goto err_free; +return -EINVAL ; }/* read reg property from dts */ @@ -688,17 +687,19 @@ static int fsl_re_chan_probe(struct platform_device *ofdev, chandev = &chan_ofdev->dev;tasklet_setup (&chan->irqtask, fsl_re_dequeue);
Quoted 6 lines
Quoted 3 lines
drivers/dma/fsl_raid.c static int fsl_re_chan_probe(struct platform_device *ofdev, · line 690
Quoted 1 line
drivers/dma/fsl_raid.c +1
-0+platform_set_drvdata (chan_ofdev, chan);Previous patch already set, why need set again?
This is because
request_irqusesplatform_get_drvdata.On further review, I think chan should be passed directly.
Yes
Frank
Quoted 82 lines
Quoted 82 lines
Frank
Quoted 80 lines
drivers/dma/fsl_raid.c +12
-4ret =request_irq (chan->irq, fsl_re_isr,0 , chan->name, chan_ofdev);if (ret) {dev_err (dev,"Unable to register interrupt for JR %d\n" , q); ret = -EINVAL ; - goto err_free; + goto err_free_tasklet; } re_priv->re_jrs[q] = chan; chan->chan.device = dma_dev; chan->chan.private = chan; chan->dev = chandev; + chan->ofdev = chan_ofdev; chan->re_dev = re_priv;spin_lock_init (&chan->desc_lock);@@ -712,7 +713,7 @@ static int fsl_re_chan_probe(struct platform_device *ofdev,if (!chan->inb_ring_virt_addr) {dev_err (dev,"No dma memory for inb_ring_virt_addr\n" ); ret = -ENOMEM ; - goto err_free; + goto err_free_irq; } chan->oub_ring_virt_addr = dma_pool_alloc(chan->re_dev->hw_desc_pool,@@ -744,8 +745,6 @@ static int fsl_re_chan_probe(struct platform_device *ofdev,out_be32 (&chan->jrregs->jr_config_1,FSL_RE_CFG1_CBSI |FSL_RE_CFG1_CBS0 | status); -platform_set_drvdata (chan_ofdev, chan); -/* Enable RE/CHAN */ out_be32 (&chan->jrregs->jr_command,FSL_RE_ENABLE );@@ -754,7 +753,12 @@ static int fsl_re_chan_probe(struct platform_device *ofdev, err_free_1:dma_pool_free (chan->re_dev->hw_desc_pool, chan->inb_ring_virt_addr, chan->inb_phys_addr); +err_free_irq: +free_irq (chan->irq, chan_ofdev); +err_free_tasklet: +tasklet_kill (&chan->irqtask); err_free: +of_platform_device_destroy (chan_ofdev);return ret; }@@ -892,6 +896,8 @@ static int fsl_re_probe(struct platform_device *ofdev)static void fsl_re_remove_chan (struct fsl_re_chan *chan) { +free_irq (chan->irq, chan->ofdev); +tasklet_kill (&chan->irqtask); dma_pool_free(chan->re_dev->hw_desc_pool, chan->inb_ring_virt_addr,@@ -899,6 +905,8 @@ static void fsl_re_remove_chan(struct fsl_re_chan *chan)dma_pool_free (chan->re_dev->hw_desc_pool, chan->oub_ring_virt_addr, chan->oub_phys_addr); + +of_platform_device_destroy (chan->ofdev); }static void fsl_re_remove (struct platform_device *ofdev)drivers/dma/fsl_raid.h +1
-1@@ -270,6 +270,7 @@ struct fsl_re_chan {struct list_head active_q;/* already issued on hw, not completed */ struct list_head submit_q;struct list_head free_q;/* alloc available queue */ +struct platform_device *ofdev;struct device *dev;struct fsl_re_drv_private *re_dev;struct dma_chan chan; --2.55.0