Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp62704pxj; Thu, 20 May 2021 04:38:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9VPnFIwm7syVXtQONSL2OY+pM9ZRajmmh7SuYZOx2AHyMmZZI1YgWT5pkQ4IDzxDUXmV8 X-Received: by 2002:a05:6402:2064:: with SMTP id bd4mr4396024edb.96.1621510690770; Thu, 20 May 2021 04:38:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621510690; cv=none; d=google.com; s=arc-20160816; b=GPBwWJpBpRb864CSuTFP5An3sepHe5BE3G4WLaBotOKN+LJobLkoy7HnvSMTthdNUA PPN7bs/k0drWaAzLIbGMyUQ55PbE+iJR/XoO84dWjC4o3A7AYk41kbeXpf8lSnVi9m4k JB0TzJdu/UlU9/o9x/5+dqaP2JEVXvMRi42Wt+6R/brJjUN8UEW3/vfY50phBBfBuZEx NsQzAFIMdZTT/p0Ue1bFpKOJ0ZAdZg/xFH0UHIxpgatlU1m5fuIwbAM7DlFVM2/iLa1P gOAnxSkV/qxy0bHxi8nAHjriR8u0mD6AYYVf3QUddomv5lGXcOgmHM1QeDwhn2E8V1hE VhVw== 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=TbslJGwIgFb/SD1hNTLqCZ0/fOFX416H09FBDjHN1sk=; b=ZnxF+rxW9KWDONDx1rdSpJEOvzQO5IMLHrAfnocvLhDZf+GXDN2f1Dwwe2z/hjFLdw GqgeCl0HXFS034xu/BrJo27zcNzdPXo/A5CYblz2moaUoFJ5kqn+uTw1U01Lmyc6MAK1 wfysQEZvCH7kyo9dcBb0wO22XFrBprpT29YOe6tfMue6r4+8ZtgAll71zKXQLpeBJrr+ n2dOaf37p0ZyJExGMnOPZjSYdPC9qwk9LSlUbQ5lrq44KAbp419cFMoq9/9JFbEPB+05 lR0MR9j7rztn+xj85IAzsqHU4ou1WL0DB28Q7NMK3EwIslbN8GEScoahBazYYVZk815U mKJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WENK9+v2; 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 r3si2378215ejs.480.2021.05.20.04.37.46; Thu, 20 May 2021 04:38:10 -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=WENK9+v2; 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 S241494AbhETLhG (ORCPT + 99 others); Thu, 20 May 2021 07:37:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:37196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239788AbhETLRA (ORCPT ); Thu, 20 May 2021 07:17:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5846761956; Thu, 20 May 2021 10:09:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505368; bh=fyJQ13977woX6+d1VGnV3ayzk50MV8fIq0h6+9uYzDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WENK9+v2qIE1zbbknxk2FdDvQ9jn4BV5svaMF8YihyPZEjMKBlY3dXNpJ2Ry1yBCo orfAazMx7/kS24E/myNGBUFn4NfQRu4H5aOZThMMaod+q0NmG4cHcuujVGNuP6rJ0C JpjeBrd6DOpHyLMUn0ju5d7hHxd4/oaugb1kSNb4= 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 4.4 102/190] sata_mv: add IRQ checks Date: Thu, 20 May 2021 11:22:46 +0200 Message-Id: <20210520092105.569626468@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@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 e6471a65fdd5efbb8dd2732dd0f063f960685ceb ] The function mv_platform_probe() neglects to check the results of the calls to platform_get_irq() and irq_of_parse_and_map() and blithely passes them to ata_host_activate() -- while the latter only checks for IRQ0 (treating it as a polling mode indicattion) and passes the negative values to devm_request_irq() causing it to fail as it takes unsigned values for the IRQ #... Add to mv_platform_probe() the proper IRQ checks to pass the positive IRQ #s to ata_host_activate(), propagate upstream the negative error codes, and override the IRQ0 with -EINVAL (as we don't want the polling mode). Fixes: f351b2d638c3 ("sata_mv: Support SoC controllers") Signed-off-by: Sergey Shtylyov Link: https://lore.kernel.org/r/51436f00-27a1-e20b-c21b-0e817e0a7c86@omprussia.ru Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/ata/sata_mv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 5718dc94c90c..601ea2e9fcf9 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c @@ -4101,6 +4101,10 @@ static int mv_platform_probe(struct platform_device *pdev) n_ports = mv_platform_data->n_ports; irq = platform_get_irq(pdev, 0); } + if (irq < 0) + return irq; + if (!irq) + return -EINVAL; host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports); hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL); -- 2.30.2