Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp341965pxj; Thu, 20 May 2021 10:32:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7yoPM0bCb6a4T/6sVBpG7gdOVcgbrbMk5YJ4T2XlESjMs8d5gt0nF10XJ3+vkJmotGsuR X-Received: by 2002:a17:906:bcf9:: with SMTP id op25mr5934972ejb.453.1621531949546; Thu, 20 May 2021 10:32:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621531949; cv=none; d=google.com; s=arc-20160816; b=SPBRksZmcb4zW36t7J30gfMsJ1YopEpEnzUF/k45hHJsLM6pudrsxoeKqwqUQuAAb6 eXxoZDkdfAYJgGfm+THH85ntWRUEC+cmpEfBhY1ESfiggBQHJIC7UOtrB14OdAZaTmu4 gEb1VEmREVuxThLBQ1UZ+QQItArZn/3A1AMm492j5nyU7pBTIan8JRLPCjc7M1v8cpWM tlTjDLilDbZeq5Z8QnqMd7Hm5ocvWJWZakmtSLwmEnkoUZ0JewdeSyrBOfDIQWwK5tqN 7vtJIJZnj9a1DMzMs/1V3v/mgzCi6Qy3ReLrvdpOsNvSc7QIronqxSDpoWymMLkQZml9 hjIQ== 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=XU7cU8MhwkZ2IFToOQbGmLA4Q/p4WT7iFBdl8EnnZB8=; b=vQ3bhJShAdoq9Xotwefmrg5IBkzv2eTdU/NRuzGrf4/KxqY3eWDroMs9VMRCFcAJ0f qRLQY8JFPfMlGCKiIHC0DzgMaKkltPvCHs+8+dn/EwlSuKEELop4cipqvg328itZOTGR gg0JNy9OWYfRJKuV9Se8mFIFU+FKH1D7k+b+lNd07Fd7O6/jJVqC+GCF0ciKNQ2e28E4 uGmHa5WDqIAyIm4+1Xa5oVpJ5SH/XhCHB0vrvIBGbi1pElM/UzhcJqzqHNIewumsa+BH MnT9otueHRjtNDvpqJNBLzIEug1TnaKZ2q+rFwJXGQYAwIlPUN3MIVLaAyzRr8CPqM1O CYuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xd57rJBv; 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 m19si3301932edd.490.2021.05.20.10.32.05; Thu, 20 May 2021 10:32:29 -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=xd57rJBv; 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 S234793AbhETKBC (ORCPT + 99 others); Thu, 20 May 2021 06:01:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:60394 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234607AbhETJ4j (ORCPT ); Thu, 20 May 2021 05:56:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4BFCF6140A; Thu, 20 May 2021 09:37:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503462; bh=OfqIR65GaFmcPl2O4Wzz767MIhstNVDSVcaJAJ7+a9k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xd57rJBvF65mOeGq1/QrcYMbmqZwVI8B23k53UbIlTjyq/3CGcEiI4nbYJCRHyGkH 3EFrAy98i7SCd9VHcNvkbzEMR5QBDTKwKY64Ap8RmBOFzQ5I922k4mPFmpdahXTf6w yzFAqucyCKnGTyGN2bmaMQy54JbXcClZzmed8pio= 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.19 233/425] sata_mv: add IRQ checks Date: Thu, 20 May 2021 11:20:02 +0200 Message-Id: <20210520092139.090357119@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@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 2910b22fac11..57ef11ecbb9b 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c @@ -4110,6 +4110,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