* [PATCH v1 1/1] ata: sata_dwc_460ex: No need to call phy_exit() befre phy_init()
@ 2021-07-27 12:51 Andy Shevchenko
2021-07-28 1:30 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2021-07-27 12:51 UTC (permalink / raw)
To: Dinghao Liu, Andy Shevchenko, linux-ide, linux-kernel; +Cc: Jens Axboe
Last change to device managed APIs cleaned up error path to simple phy_exit()
call, which in some cases has been executed with NULL parameter. This per se
is not a problem, but rather logical misconception: no need to free resource
when it's for sure has not been allocated yet. Fix the driver accordingly.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/ata/sata_dwc_460ex.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
index f0ef844428bb..338c2e50f759 100644
--- a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -1259,24 +1259,20 @@ static int sata_dwc_probe(struct platform_device *ofdev)
irq = irq_of_parse_and_map(np, 0);
if (irq == NO_IRQ) {
dev_err(&ofdev->dev, "no SATA DMA irq\n");
- err = -ENODEV;
- goto error_out;
+ return -ENODEV;
}
#ifdef CONFIG_SATA_DWC_OLD_DMA
if (!of_find_property(np, "dmas", NULL)) {
err = sata_dwc_dma_init_old(ofdev, hsdev);
if (err)
- goto error_out;
+ return err;
}
#endif
hsdev->phy = devm_phy_optional_get(hsdev->dev, "sata-phy");
- if (IS_ERR(hsdev->phy)) {
- err = PTR_ERR(hsdev->phy);
- hsdev->phy = NULL;
- goto error_out;
- }
+ if (IS_ERR(hsdev->phy))
+ return PTR_ERR(hsdev->phy);
err = phy_init(hsdev->phy);
if (err)
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1 1/1] ata: sata_dwc_460ex: No need to call phy_exit() befre phy_init()
2021-07-27 12:51 [PATCH v1 1/1] ata: sata_dwc_460ex: No need to call phy_exit() befre phy_init() Andy Shevchenko
@ 2021-07-28 1:30 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-07-28 1:30 UTC (permalink / raw)
To: Andy Shevchenko, Dinghao Liu, linux-ide, linux-kernel
On 7/27/21 6:51 AM, Andy Shevchenko wrote:
> Last change to device managed APIs cleaned up error path to simple phy_exit()
> call, which in some cases has been executed with NULL parameter. This per se
> is not a problem, but rather logical misconception: no need to free resource
> when it's for sure has not been allocated yet. Fix the driver accordingly.
Applied for 5.15, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-28 1:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-27 12:51 [PATCH v1 1/1] ata: sata_dwc_460ex: No need to call phy_exit() befre phy_init() Andy Shevchenko
2021-07-28 1:30 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).