Skip to content

Commit 01a965d

Browse files
chleroyDamien Le Moal
authored andcommitted
ata: sata_dwc_460ex: Check !irq instead of irq == NO_IRQ
NO_IRQ is a relic from the old days. It is not used anymore in core functions. By the way, function irq_of_parse_and_map() returns value 0 on error. In some drivers, NO_IRQ is erroneously used to check the return of irq_of_parse_and_map(). It is not a real bug today because the only architectures using the drivers being fixed by this patch define NO_IRQ as 0, but there are architectures which define NO_IRQ as -1. If one day those architectures start using the non fixed drivers, there will be a problem. Long time ago Linus advocated for not using NO_IRQ, see https://lkml.org/lkml/2005/11/21/221 . He re-iterated the same view recently in https://lkml.org/lkml/2022/10/12/622 So test !irq instead of tesing irq == NO_IRQ. And remove the fallback definition of NO_IRQ at the top of the file. Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Damien Le Moal <[email protected]>
1 parent aebf1e2 commit 01a965d

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/ata/sata_dwc_460ex.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@
4242
#define sata_dwc_writel(a, v) writel_relaxed(v, a)
4343
#define sata_dwc_readl(a) readl_relaxed(a)
4444

45-
#ifndef NO_IRQ
46-
#define NO_IRQ 0
47-
#endif
48-
4945
#define AHB_DMA_BRST_DFLT 64 /* 16 data items burst length */
5046

5147
enum {
@@ -242,7 +238,7 @@ static int sata_dwc_dma_init_old(struct platform_device *pdev,
242238

243239
/* Get SATA DMA interrupt number */
244240
hsdev->dma->irq = irq_of_parse_and_map(np, 1);
245-
if (hsdev->dma->irq == NO_IRQ) {
241+
if (!hsdev->dma->irq) {
246242
dev_err(dev, "no SATA DMA irq\n");
247243
return -ENODEV;
248244
}
@@ -1178,7 +1174,7 @@ static int sata_dwc_probe(struct platform_device *ofdev)
11781174

11791175
/* Get SATA interrupt number */
11801176
irq = irq_of_parse_and_map(np, 0);
1181-
if (irq == NO_IRQ) {
1177+
if (!irq) {
11821178
dev_err(dev, "no SATA DMA irq\n");
11831179
return -ENODEV;
11841180
}

0 commit comments

Comments
 (0)