ata: sata_dwc_460ex: Don't enable interrupt if libATA core registration fails
PATCH v3 1/1 ata: sata_dwc_460ex: Don't enable interrupt if libATA core registration fails
Recent 4bbc16a353a9 commit changed the timing when interrupts are enabled. However it didn't account for the libATA registration step. So it's possible that interrupts are enabled when the device is not registered with libATA core.
Resolve the issue by ensuring that interrupts are enabled only if the rest of the initialization is successful.
---
Changes since v1:
* Added proper goto label
Changes since v2:
* Rework logic so that interrupts are enabled if everything is successful and don't call phy_exit otherwise, as the driver is quite broken w.r.t to it.
drivers/ata/sata_dwc_460ex.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/ata/sata_dwc_460ex.c +5 -3
@@ -1185,11 +1185,13 @@ static int sata_dwc_probe(struct platform_device *ofdev)* error_handler() to execute a dummy Softreset EH session */ err =ata_host_activate (host, irq, sata_dwc_isr,0 , &sata_dwc_sht); -if (err) +if (err) {dev_err (dev,"failed to activate host" ); + }else { +/* Enable SATA Interrupts */ +sata_dwc_enable_interrupts (hsdev); + } -/* Enable SATA Interrupts */ -sata_dwc_enable_interrupts (hsdev);return 0 ; error_out:
--
2.55.0
Damien Le Moal
maintainerQuoted 27 lines · Nikolay Borisov
Recent
4bbc16a353a9commit changed the timing when interrupts are enabled. However it didn't account for the libATA registration step. So it's possible that interrupts are enabled when the device is not registered with libATA core.Resolve the issue by ensuring that interrupts are enabled only if the rest of the initialization is successful.
Fixes 4bbc16a353a9 ("ata: sata_dwc_460ex: enable SATA interrupts only after IRQ handler is registered")Signed-off-by Nikolay Borisov <[email protected]>---
Changes since v1:
* Added proper goto label
Changes since v2:
* Rework logic so that interrupts are enabled if everything is successful and don't callphy_exitotherwise, as the driver is quite broken w.r.t to it.drivers/ata/sata_dwc_460ex.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/ata/sata_dwc_460ex.c +0
-0
drivers/ata/sata_dwc_460ex.c static int sata_dwc_probe(struct platform_device *ofdev) · line 1189
Quoted 6 lines
drivers/ata/sata_dwc_460ex.c +1
-1@@ -1185,11 +1185,13 @@ static int sata_dwc_probe(struct platform_device *ofdev)* error_handler() to execute a dummy Softreset EH session */ err =ata_host_activate (host, irq, sata_dwc_isr,0 , &sata_dwc_sht); -if (err) +if (err) {dev_err (dev,"failed to activate host" );
Why not simply "goto err_out;" here ?
Quoted 12 lines
drivers/ata/sata_dwc_460ex.c +4
-3+ }else { +/* Enable SATA Interrupts */ +sata_dwc_enable_interrupts (hsdev); + } -/* Enable SATA Interrupts */ -sata_dwc_enable_interrupts (hsdev);return 0 ; error_out: --2.55.0
Signature · 2 lines
Damien Le Moal Western Digital Research
Quoted 23 lines · Damien Le Moal
Quoted 22 lines · Nikolay Borisov
Recent
4bbc16a353a9commit changed the timing when interrupts are enabled. However it didn't account for the libATA registration step. So it's possible that interrupts are enabled when the device is not registered with libATA core.Resolve the issue by ensuring that interrupts are enabled only if the rest of the initialization is successful.
Fixes 4bbc16a353a9 ("ata: sata_dwc_460ex: enable SATA interrupts only after IRQ handler is registered")Signed-off-by Nikolay Borisov <[email protected]>---
Changes since v1:
* Added proper goto label
Changes since v2:
* Rework logic so that interrupts are enabled if everything is successful and don't callphy_exitotherwise, as the driver is quite broken w.r.t to it.drivers/ata/sata_dwc_460ex.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
Quoted 13 lines
drivers/ata/sata_dwc_460ex.c static int sata_dwc_probe(struct platform_device *ofdev) · line 1189
Quoted 11 lines
drivers/ata/sata_dwc_460ex.c +1
-1@@ -1185,11 +1185,13 @@ static int sata_dwc_probe(struct platform_device *ofdev)* error_handler() to execute a dummy Softreset EH session */ err =ata_host_activate (host, irq, sata_dwc_isr,0 , &sata_dwc_sht); -if (err) +if (err) {dev_err (dev,"failed to activate host" );Why not simply "goto
err_out;" here ?
That was in V2 however Niklas discovered some issue w.r.t to phy_exit. https://lore.kernel.org/all/aqGFjsuIMRIy5xfv@ryzen/
Quoted 15 lines
Quoted 13 lines
drivers/ata/sata_dwc_460ex.c +4
-3+ }else { +/* Enable SATA Interrupts */ +sata_dwc_enable_interrupts (hsdev); + } -/* Enable SATA Interrupts */ -sata_dwc_enable_interrupts (hsdev);return 0 ; error_out: --2.55.0
Niklas Cassel
maintainerQuoted 40 lines · Nikolay Borisov
Quoted 23 lines · Damien Le Moal
Quoted 22 lines · Nikolay Borisov
Recent
4bbc16a353a9commit changed the timing when interrupts are enabled. However it didn't account for the libATA registration step. So it's possible that interrupts are enabled when the device is not registered with libATA core.Resolve the issue by ensuring that interrupts are enabled only if the rest of the initialization is successful.
Fixes 4bbc16a353a9 ("ata: sata_dwc_460ex: enable SATA interrupts only after IRQ handler is registered")Signed-off-by Nikolay Borisov <[email protected]>---
Changes since v1:
* Added proper goto label
Changes since v2:
* Rework logic so that interrupts are enabled if everything is successful and don't callphy_exitotherwise, as the driver is quite broken w.r.t to it.drivers/ata/sata_dwc_460ex.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)Quoted 13 lines
drivers/ata/sata_dwc_460ex.c static int sata_dwc_probe(struct platform_device *ofdev) · line 1189
Quoted 11 lines
drivers/ata/sata_dwc_460ex.c +1
-1@@ -1185,11 +1185,13 @@ static int sata_dwc_probe(struct platform_device *ofdev)* error_handler() to execute a dummy Softreset EH session */ err =ata_host_activate (host, irq, sata_dwc_isr,0 , &sata_dwc_sht); -if (err) +if (err) {dev_err (dev,"failed to activate host" );Why not simply "goto
err_out;" here ?
Quoted 2 lines
That was in V2 however Niklas discovered some issue w.r.t to
phy_exit.
https://lore.kernel.org/all/aqGFjsuIMRIy5xfv@ryzen/
I have since merged a series, which is queued on ibata/linux.git (for-7.4):
https://lore.kernel.org/linux-ide/[email protected]/
See:
https://lore.kernel.org/linux-ide/[email protected]/
Where, if ata_host_activate() failed after ata_host_start() returned success (which will have called call->port_start()), it will call ata_host_undo_start() which will call ->port_stop().
Thus, the Sashiko comment on your v2:
https://lore.kernel.org/linux-ide/[email protected]/
is no longer valid.
Please send your V2 again (as a V4) just so that we can get Sashiko to review it again.
Preferably use:
$ git format-patch --base libata/for-7.4
So that it adds the proper base commit that you depend on.
Kind regards,
Niklas