Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp633791pxa; Thu, 27 Aug 2020 11:26:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzARBTyO0Cmw0KOJUroqrf0PYqlVupZnfxJqQ8AGcCuOOZDDvYugcoWDGmjK+8FXHb4+Y9q X-Received: by 2002:a50:bf01:: with SMTP id f1mr21605833edk.369.1598552784664; Thu, 27 Aug 2020 11:26:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598552784; cv=none; d=google.com; s=arc-20160816; b=UPjU6UgsYB5a6z2rfvLl2qdeAPMama9XfC3yM2JwPMyEVBOIQx/OiAXPMkpzHx+TdQ roLI9d4F1XQf+f7ry0MtjiY72zwzmRU34USABqp/edT6n+ahu7jxeUPQprxv8kAsqYKe 2csLQe+cXoap+2+kPuahUS0MeZu1UEcV6RrDXYmd+3ZGGpjtzyP449EsxDUPpfRZ4LO+ to9l/S8Uc3p0cLc8LsnUC6XhK0gmHibbZ/n0yfVS4eGpwvyKxJNat7+tGlUY4hxnO0Ni EDeXLmSQct3E5uO1e3ceQiA1djtqxnT2gPRMyiNo5sgYyjr2e7PtjaZj3H7wxZBF2YUt sAiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=H2wIkW8Q7FK9nWMf/kb9MG+eMPZ8wpS5dNJHbQ2Jxfk=; b=bXP2wqYBh4/6XLAjx6tl0s3MWXLtLOjc1tRTXwQbyLmZepqE4swD7vIl4qAE5lVVhu 8P3N9LNM+zgwubIESOSgoqKlFQ+mKh0koImN1Kyqxb1zmIOcrBuaodcSGVpiaHVwguzh 2qoQUocMTe0d4ox0Jo1D+qa6mLO1SXgK99Gc+71iuht/TiwHpC2n79RgOkO3nMpGLQCd QFpewW6ZvEHHw6WfvOJvM7i8AAWX3sM52JtbQkuUrTrsUXxaPhS7hE8KeFjKpT+lxpql uFKuUcrkLxxK2PJTWCNmba3afkJ2GVGHCgbj/DvTY2u3NFqFZnzlmGpSlKl2sHbrxC/y WT4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IwTyGYXl; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a14si1991988edx.573.2020.08.27.11.26.01; Thu, 27 Aug 2020 11:26:24 -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=IwTyGYXl; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726266AbgH0SZO (ORCPT + 99 others); Thu, 27 Aug 2020 14:25:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:33540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726197AbgH0SZN (ORCPT ); Thu, 27 Aug 2020 14:25:13 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 834FE2087C; Thu, 27 Aug 2020 18:25:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598552713; bh=Z0fq8dm88+dU9bSyD1/ti5vEZonGfauWaztGQMRRjv4=; h=From:To:Cc:Subject:Date:From; b=IwTyGYXlnbFOhjBVfmnr32F+ohdbcGf6mHx2E6En0fwR5qRBHq9yO91+/S6zv2h0w 4+NDrFOePMEVUsNYcT3MvpBJoxWD+XLp4nmvr2ulQcvggxIVrcUxRGGgOk39RdthS2 ksaZ/x2Y9mvHGkvPkj4TIMDEonMo0PEZr+dfXpt8= From: Krzysztof Kozlowski To: Jassi Brar , Matthias Brugger , CK Hu , HS Liao , Houlong Wei , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Cc: Frank Wunderlich , Krzysztof Kozlowski Subject: [PATCH v3] mailbox: mediatek: Fix handling of platform_get_irq() error Date: Thu, 27 Aug 2020 20:25:07 +0200 Message-Id: <20200827182507.4938-1-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Changes since v2: 1. Fix subject. Changes since v1: 1. Correct u32->int, 2. Fix left-over '!'. --- 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 484d4438cd83..5665b6ea8119 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; @@ -525,10 +525,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; plat_data = (struct gce_plat *)of_device_get_match_data(dev); if (!plat_data) { -- 2.17.1