Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp484737pxx; Wed, 28 Oct 2020 09:22:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3U8yZosn6wU7WbVxLtR9yGHcwa3UAUKLQLxQVHg8mpu0qoaJ5RJod1CtcsYa1v5dCPUaN X-Received: by 2002:a17:906:268c:: with SMTP id t12mr7933872ejc.377.1603902139143; Wed, 28 Oct 2020 09:22:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603902139; cv=none; d=google.com; s=arc-20160816; b=R7+z8TXp00vYT8wVIU+CQo0CE/G6GLr+w5cdHR2uazT0bIs1cc7/ZEtkDNMg8ebM9U 9or9rTf1AGTTQP0UWP3ruBNaAYDnRybmOgxvp1SQGCk/Tzt2lQR17t0OSYQCLV1uEm8e zScTMS8oZULyNhngnYiEtuoltRIr5/XgTT1jvlAubzmRTBQmNQE/wfO1HCfDveqPL27/ 7MOiRerqQS4qRLJR3aEbiKPRZYHbdSEh4ULr+6jP2UHekxqaCHGIfgtwmZuIuD/v11+v c72FdZhuCccV4YF5jK3yJhDftIYJ0AcL/sKtbdc+PkUmJFvurgRJRIL9aeTSqN0dmUUP bbxA== 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=Iz99yoBST9WYqv6NBM4vPLN9FwKED2awlPFxCzpb5c0=; b=Eh0F64TP9mu8wK/eQoXJ+A8Gou1XdP2Sh+g0nslFKhi0hsb+n/+YFJ6C3CchBancPc LFsH1WA86HfWR4UivpFftLElrvZl5fc5ysj7ux//m0nbQQgwbtyLabotcUStMFyNdxfG Bpdf05hho78+c2zRUUhjB9raTirwMDV4dlfLidD2VMANNdE5oQBv17MHgDkZ1V4Z9NS+ qDDWf34CEFtaJFfr34a/yjOFhynW14AuJBEkhQxDgozjvTA/qZh0tEH8xr7IT2U1Myk4 MDK+Y7ZOeGSvRyUNFfG8UWorEO5fmBmmzfPS+vkRi/82/pqlDzwFSDX1V8eWXBQCVJCT YRVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Nv1U4y3t; 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=fail (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 p17si3794338ejw.710.2020.10.28.09.21.56; Wed, 28 Oct 2020 09:22:19 -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=@kernel.org header.s=default header.b=Nv1U4y3t; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1816517AbgJ0RHY (ORCPT + 99 others); Tue, 27 Oct 2020 13:07:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:41160 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1793532AbgJ0PGs (ORCPT ); Tue, 27 Oct 2020 11:06:48 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9303421D24; Tue, 27 Oct 2020 15:06:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811208; bh=2feg3muA8Euj01Bgw8grGB9U/yK1bGesHqI5fFCEQcY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nv1U4y3txlxaY+0kMOVEfUfiJZvqqYPmAXR5XdD88chQErj7gDqrW5yoMd+5vIluC MT5fqLAuiGkssQBGCO5R6F7WyTPOdSfe8pZTCpu6Iv0qSuQfgn9Q7pEcvD45WIjd6L MK9R53Iut3jZ37SBouseNWxYUKGCuDN/if5oRJPk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Jassi Brar , Sasha Levin Subject: [PATCH 5.8 410/633] maiblox: mediatek: Fix handling of platform_get_irq() error Date: Tue, 27 Oct 2020 14:52:33 +0100 Message-Id: <20201027135541.957724451@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@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: Krzysztof Kozlowski [ Upstream commit 558e4c36ec9f2722af4fe8ef84dc812bcdb5c43a ] platform_get_irq() returns -ERRNO on error. In such case casting to u32 and comparing to 0 would pass the check. Fixes: 623a6143a845 ("mailbox: mediatek: Add Mediatek CMDQ driver") Signed-off-by: Krzysztof Kozlowski Signed-off-by: Jassi Brar Signed-off-by: Sasha Levin --- drivers/mailbox/mtk-cmdq-mailbox.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c index b24822ad8409c..9963bb9cd74fa 100644 --- a/drivers/mailbox/mtk-cmdq-mailbox.c +++ b/drivers/mailbox/mtk-cmdq-mailbox.c @@ -69,7 +69,7 @@ struct cmdq_task { struct cmdq { struct mbox_controller mbox; void __iomem *base; - u32 irq; + int irq; u32 thread_nr; u32 irq_mask; struct cmdq_thread *thread; @@ -466,10 +466,8 @@ static int cmdq_probe(struct platform_device *pdev) } cmdq->irq = platform_get_irq(pdev, 0); - if (!cmdq->irq) { - dev_err(dev, "failed to get irq\n"); - return -EINVAL; - } + if (cmdq->irq < 0) + return cmdq->irq; cmdq->thread_nr = (u32)(unsigned long)of_device_get_match_data(dev); cmdq->irq_mask = GENMASK(cmdq->thread_nr - 1, 0); -- 2.25.1