Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4609633pxj; Wed, 12 May 2021 09:11:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDuSbXm/BDHltuwwDCWTHey0QEXacaFvM6uoMCtFLz9x9gj8EWooAYWFQGdE2kSt3oTL+i X-Received: by 2002:a05:6402:3548:: with SMTP id f8mr43788997edd.251.1620835862424; Wed, 12 May 2021 09:11:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835862; cv=none; d=google.com; s=arc-20160816; b=tE4DQsP6PfZ7BhxE0EseIPGn4JZqZpdEuoUAe7eLBxQM2AS7gnRL/c8dRWc+WXjdYP byrQxFARR6RnjZH506ZAgj7iTxcoy5BV42XOGE+oO3ysGvawjNJd/0O9QOad9tZAf25W bZlEWEtNjQhsSF+7MSVhUJH4tQ/zXgXvzoeaaQOZFnS3V54z9pozge/nRWfUjKv1UAg0 UVHuqVuzfB1NrBXIaZE7VO/gsMDiFA/WuiXYnTzKvc7qxRUBWpgjNPooTHIihMLlmB5Z 5r662CbfU7f1qJJGbN/bAzwC/jA1tfh7foXmJ2QYIjTF+2Ql9EJ9oMFip2fCs9QCUvj6 z6Lw== 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=ANAMx7LsIxQguN+qePouWu534CfzTgXp3bahkmJgYRQ=; b=rW2HWhlZqo/8KcFUvm5tP1szHxkL+8WVFaUSz4NrCPv2tvlRJYw3ROkZwX6G25ayLe mwWiDXS9xZWXegSdr8SBzXJyGilc/JkxvBn1C5Ge7agqc2aMhrG0ljBd8PPOYGd8xoii /64feeM3A9MXz9elhq2rPz+YSlP3/ynmFd2O6wdn/TiaBuRe6JC7kNren3nuK97zN+xZ ssG9yWpzzy02lLcZBv9uztTQIg7MineR5VSHdy1gCS9Gwexrq1RTl/CgYOmuQ7irb8qk F4pFMbZnw6w18Suz6vh8MT90TWfYyTeRXFld3CIIqZfvm/Fvv8YflnzhvjQNlRp7LUFE /lHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HgFF8OKB; 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 ga17si244607ejb.144.2021.05.12.09.10.38; Wed, 12 May 2021 09:11:02 -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=HgFF8OKB; 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 S239492AbhELQIJ (ORCPT + 99 others); Wed, 12 May 2021 12:08:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:38716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231790AbhELP2s (ORCPT ); Wed, 12 May 2021 11:28:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5700E61937; Wed, 12 May 2021 15:14:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832495; bh=UWW9+BAM+LXgqtj/HB8pbk3FYOu9y4je8Aitgu8lXW8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HgFF8OKBq5oKki8WjxN/Xcp/pX57olwrdf11Hv1aupC1l06q8y+SO/l3FOLvDmKlO Mt6oTXmHr2bscwtl7hOecTengFNdiMg+9zQwiamrhfLJNYi+ODQ9XrG4TjaSf4BTiu MjWcl0I5h1DwyHGu4M04tZX5jfRNZpDCSJlrVOro= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Jens Axboe , Sasha Levin Subject: [PATCH 5.10 304/530] pata_ipx4xx_cf: fix IRQ check Date: Wed, 12 May 2021 16:46:54 +0200 Message-Id: <20210512144829.788694961@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 e379b40cc0f179403ce0b82b7e539f635a568da5 ] 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 errors upstream, and treat IRQ0 as error, returning -EINVAL, as the libata code treats 0 as an indication that polling should be used anyway... Fixes: 0df0d0a0ea9f ("[libata] ARM: add ixp4xx PATA driver") Signed-off-by: Sergey Shtylyov Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/ata/pata_ixp4xx_cf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c index d1644a8ef9fa..abc0e87ca1a8 100644 --- a/drivers/ata/pata_ixp4xx_cf.c +++ b/drivers/ata/pata_ixp4xx_cf.c @@ -165,8 +165,12 @@ static int ixp4xx_pata_probe(struct platform_device *pdev) return -ENOMEM; irq = platform_get_irq(pdev, 0); - if (irq) + if (irq > 0) irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING); + else if (irq < 0) + return irq; + else + return -EINVAL; /* Setup expansion bus chip selects */ *data->cs0_cfg = data->cs0_bits; -- 2.30.2