Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1820466rwb; Fri, 11 Nov 2022 00:23:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf752Gf0pzvpLLJyWNL3n1YIcI1cCOGBesFzCb0c3+sQhHa1xoFnBhLWfouHJnFgbyHUkA0n X-Received: by 2002:a63:f94d:0:b0:470:3fc2:65af with SMTP id q13-20020a63f94d000000b004703fc265afmr714404pgk.492.1668155031520; Fri, 11 Nov 2022 00:23:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668155031; cv=none; d=google.com; s=arc-20160816; b=qGu27Ma4FkDOlGu4J4iodbXFdQB0LBwl3a2p1WV6qe8LepXFhXgKhjIZnuUcV0aipy D6F1lnz0lMG/sAe3JbXZ2IcWO66aHcJaYQh70epTsknBwytI73cY3AJ9XAGgTdU1cWir nabBnZFiGJT+0WMmOPv4jTlNgHy4CLCCcF4FQio0L+ZVmYtPrZy5uKXwwU5GoBNYnO2T hXC/ZyAvv0ATuX28GWv7ddYrJYL9yqLrfYy/Ev1ZbpfaX1uEa2JhIGQmgx+kmmZq/l9N OfYtkrtOh3ouV83XWYeafS4sFgi/5MRIFLIZMMcorB6RwyXgwWdLAMOjXloWhHpShyAb u0mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=wCDW1EYRKIW/EkwGyxAZTVaUD3CqPRJ6BVudHZB2z2Q=; b=OEBzV4QhbcZNv+lghMYG54i3vzD1C+8I+OooviWLB+Z/eSCdeQQ3eLrfWHLZw9XJ+/ 2aaQfGv/cGlebDygAkpfSFH8x2Pw8lZMqHTkpqVeaFSEtuqVrrnRbcl6FEYEm2SKQ3vh E6G8BvPyCr1lT3CFrYJrXikzh4NyWM5MLsBOIc3WtVPLMynZIp180MOrh5IqwPAX6O1z pj2MOVwM+rtZ8xtkxLVRngFWTrF4IYtF/ls5DOUpZuvhpbVZd63zg5vbi9E+e8Yt545I WYB/8GSs+6gK7Gi1dFP1X7jg26mQqkTxIW7DR/D6RnUPwB8xxzc9/Krc9BbuCWe1esjU KwVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k22-20020a170902ba9600b00186e8c3782esi1707537pls.386.2022.11.11.00.23.39; Fri, 11 Nov 2022 00:23:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232921AbiKKINS (ORCPT + 94 others); Fri, 11 Nov 2022 03:13:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230377AbiKKINQ (ORCPT ); Fri, 11 Nov 2022 03:13:16 -0500 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBAA1729A0; Fri, 11 Nov 2022 00:13:14 -0800 (PST) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4N7s072rwQz9snR; Fri, 11 Nov 2022 09:13:11 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 07M8D8QAOO2x; Fri, 11 Nov 2022 09:13:11 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4N7s063rWRz9snY; Fri, 11 Nov 2022 09:13:10 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 75DA78B763; Fri, 11 Nov 2022 09:13:10 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 45bLmjQ46Rob; Fri, 11 Nov 2022 09:13:10 +0100 (CET) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.235.201]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 442AC8B786; Fri, 11 Nov 2022 09:13:10 +0100 (CET) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 2AAIoap61220191 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 10 Nov 2022 19:50:36 +0100 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 2AAIoY851220189; Thu, 10 Nov 2022 19:50:34 +0100 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Damien Le Moal Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org Subject: [PATCH] ata: sata_dwc_460ex: Check !irq instead of irq == NO_IRQ Date: Thu, 10 Nov 2022 19:50:33 +0100 Message-Id: X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1668106231; l=1673; s=20211009; h=from:subject:message-id; bh=697B1goXQCfCxCA8jP4a/aN+jcy10LL+IqzfU/rtgcU=; b=/bAZD59D7IhmBsRVLLf9ggh312NYkXw4m3g7vxpft2/aRG/FjRQ5sSJl85mXQsVi+6XKdrvhWBzL 2k0tpyW2CCXgccKpZ3DGHikIMtUldnUOpQXPI+caqba0Olj0PYPW X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Christophe Leroy --- drivers/ata/sata_dwc_460ex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c index e3263e961045..5fb80ccde65b 100644 --- a/drivers/ata/sata_dwc_460ex.c +++ b/drivers/ata/sata_dwc_460ex.c @@ -242,7 +242,7 @@ static int sata_dwc_dma_init_old(struct platform_device *pdev, /* Get SATA DMA interrupt number */ hsdev->dma->irq = irq_of_parse_and_map(np, 1); - if (hsdev->dma->irq == NO_IRQ) { + if (!hsdev->dma->irq) { dev_err(dev, "no SATA DMA irq\n"); return -ENODEV; } @@ -1180,7 +1180,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) /* Get SATA interrupt number */ irq = irq_of_parse_and_map(np, 0); - if (irq == NO_IRQ) { + if (!irq) { dev_err(dev, "no SATA DMA irq\n"); return -ENODEV; } -- 2.37.1