Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4679576pxj; Wed, 12 May 2021 10:43:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwShQb/kf4m5MMVBDOT23+6cRNf/y84quhKHBc6rqp6/WJhYcG57voY/hYg9ojeUvxie7c1 X-Received: by 2002:a17:906:52d7:: with SMTP id w23mr39748825ejn.451.1620841384338; Wed, 12 May 2021 10:43:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620841384; cv=none; d=google.com; s=arc-20160816; b=e0JHxLqXMlsoVc5UepFuSkUgsH1m+QDRDdQa9F0La+x3VJgbaIDBYPjOYxn+90CPrC on5TuzlKaPakAkJnbIem8xWBn/apxGiHrRhN7wtZJ2KiB9iGuMHKwydlJtUK8pu7JY6V hQNw3h4FLo1sdJLrLL7fFtSxEtfRU7tgAAPsgtN1iTaE4YD+UzG4LuRBi0jNw6bKhd8H xyIdou11p7SChAdNh+d/Z+ZhWYmA52VtB/iXnDNyA5ma1C6bM7buu5yqc8V30tEVJEgQ RXQeyAjDdGknXfzwgwQ2HYvyQm8rCWdMOn24sQSNgkCsS6vbc7Pvr5Y/TARVm0wVTDcM /n7A== 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=J2hQuHqexZOJRNnPqAHxtbrhsNEg2A+GUiQVPWe8ZrY=; b=gnqXVEv0Y0vk7wn69KAOviPeFuv2dLMKgigH/46fJCA/sXCd0YkDoC5lOCIqX0ZaND GUeuyYIxnyExUcFllVu49QNhHHGkU+mxhnia/M4PRwONdAmGvRRvYPJU2HA3kruxvFTy BqFLntMkq2h+64iz5CU9JCB6kJKONFZCsQxZjsy5VDUiRwnDKbfbdQcafXl0BNCEhjkW XeyXPg0a2Nt8RQxxvzi9ffJMoOnSr7m7aQ7xTaHcxw/Cx1qhVkVZ9UJh4TUt2uuiaB8y kCF9bPNWgZa5oPaedhRrYeilX/KMI49YPEeffkN6WpnyJaBc/GQv9Eo0Kg/HVOmJP2gV Cglw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hi8N6weW; 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 o6si20783edi.480.2021.05.12.10.42.40; Wed, 12 May 2021 10:43:04 -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=Hi8N6weW; 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 S1348524AbhELRht (ORCPT + 99 others); Wed, 12 May 2021 13:37:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:34834 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239546AbhELQJ7 (ORCPT ); Wed, 12 May 2021 12:09:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B646C61D37; Wed, 12 May 2021 15:40:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620834004; bh=5wl/9twl21FMEylK+vwAE5nQvQkmW1u5oomSYaj8YHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hi8N6weWAmB8Y4nSWQOheN0dYuHzYEY5AgYUKcRBi6hIfkX/+RpRiCwn0m3EXGimw ySfJqm2FTmAM91uUAFOM3SqI8ItsKS4S/dPBvtY0RzYaPYBly4BSQ+K1gDr+fDoCGi Az9K0KyFRGkPz+9h05to2A9DPxQC03w4PlFugdJ4= 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.11 337/601] sata_mv: add IRQ checks Date: Wed, 12 May 2021 16:46:54 +0200 Message-Id: <20210512144838.898440049@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144827.811958675@linuxfoundation.org> References: <20210512144827.811958675@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 664ef658a955..b62446ea5f40 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c @@ -4097,6 +4097,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