Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4615905pxj; Wed, 12 May 2021 09:18:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWLqJlzxYZKBkNPRxS4lrZF/YQ+YYlGiGlIFjr6wnaAadOm+BXm9J4pgT7SIpSvDHEFF/l X-Received: by 2002:aa7:c896:: with SMTP id p22mr44336729eds.225.1620836294541; Wed, 12 May 2021 09:18:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620836294; cv=none; d=google.com; s=arc-20160816; b=FFygGvnH+O87c+r8BlvwD1i2CzK/pcYl0bm+jJw9B+PlTXXV4qn608onbDjfZZhau2 5YoO/aB39oClXhjsTb9HFtAQehb/CzgYpcpvYa9e8TuOz57kv2F42iNbGRzi4dts5Ftj 7Ayw12KPhOEzxTMBkKO+VCf714qC4skPMd8uww5S4DZ22D7BpkM4oAbDqTLPLWSUaMTK 1W3fReZgn7QTJcIhwUAhA+HU/9ldEEL+8d0+aiWKTiu/aae9ud2wbI0jutMOEBwfIGru 9y1yuNzRD+WkNB975z0abKoYwpccOj0f6weqlUn9yRdFpFG7Kch7pZfBu1i9MpcqwxyY DH9g== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LD1F6i+jL4N4jyMCR4Au4EtEA4BJy0h77+jhvz1KnCs=; b=nH5a+LfWrh4g2FadbmEPQr9X5g2+rCZtPId4ggDZ9L64lHyOiQ4Jff7y9z5bT0q9wf zGBW6nelsShQvEkJJydZanI7bAcy+Ec/NtSFA0oNgLLeeF5ZE7oeQLyvBqBj92oqVhsl 6ts3OnDLNvjRU0FeY2vGSRRKggdI60S+IhPsNClpmzK1qnCLcGDdoJBfqWy6JRpIUX3H grd313nCxAn5bHOTyLVipuQQ2JoGVcVkdPB2RREbmlYy2TcEdRwXmAjpNt55WNf00NpZ W1oXzhMxqDYAPF5WOSbcqwB5VNDzQGdWXjNDHSmTIRyZPrPQjDPp/55Z8h4wb22Qx6Ah rhag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VUGhQDWi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j6si97849edv.294.2021.05.12.09.17.48; Wed, 12 May 2021 09:18:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VUGhQDWi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239473AbhELQIH (ORCPT + 99 others); Wed, 12 May 2021 12:08:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:40904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235708AbhELP2r (ORCPT ); Wed, 12 May 2021 11:28:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E768D61928; Wed, 12 May 2021 15:14:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832493; bh=WRvG1EINOCKrSzXJphB66WYHEk3Gyc+nby5WPI1Ew0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VUGhQDWiyv02j2c2/LGK87yD252i6CNAP4UAyvyge2lZl5KIatvGH0ih8zf2uzF3L zzzvj1V4sXyU8z3lbGLjLu8+K3paIbYWN7MWjUDUG7YJ+PBz3FNwwYEg/ofB9NjGqh bzWbNxl+5jwhmQLMyAoWBKjcUeEZuZxvwsPnfGDA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Viresh Kumar , Jens Axboe , Sasha Levin Subject: [PATCH 5.10 303/530] pata_arasan_cf: fix IRQ check Date: Wed, 12 May 2021 16:46:53 +0200 Message-Id: <20210512144829.756387476@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sergey Shtylyov [ Upstream commit c7e8f404d56b99c80990b19a402c3f640d74be05 ] The driver's probe() method is written as if platform_get_irq() returns 0 on error, while actually it returns a negative error code (with all the other values considered valid IRQs). Rewrite the driver's IRQ checking code to pass the positive IRQ #s to ata_host_activate(), propagate upstream -EPROBE_DEFER, and set up the driver to polling mode on (negative) errors and IRQ0 (libata treats IRQ #0 as a polling mode anyway)... Fixes: a480167b23ef ("pata_arasan_cf: Adding support for arasan compact flash host controller") Signed-off-by: Sergey Shtylyov Acked-by: Viresh Kumar Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/ata/pata_arasan_cf.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c index e9cf31f38450..63f39440a9b4 100644 --- a/drivers/ata/pata_arasan_cf.c +++ b/drivers/ata/pata_arasan_cf.c @@ -818,12 +818,19 @@ static int arasan_cf_probe(struct platform_device *pdev) else quirk = CF_BROKEN_UDMA; /* as it is on spear1340 */ - /* if irq is 0, support only PIO */ - acdev->irq = platform_get_irq(pdev, 0); - if (acdev->irq) + /* + * If there's an error getting IRQ (or we do get IRQ0), + * support only PIO + */ + ret = platform_get_irq(pdev, 0); + if (ret > 0) { + acdev->irq = ret; irq_handler = arasan_cf_interrupt; - else + } else if (ret == -EPROBE_DEFER) { + return ret; + } else { quirk |= CF_BROKEN_MWDMA | CF_BROKEN_UDMA; + } acdev->pbase = res->start; acdev->vbase = devm_ioremap(&pdev->dev, res->start, -- 2.30.2