Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1071625yba; Wed, 24 Apr 2019 14:33:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRimP0OVJxhx5/pZBNXkEji+Cok1KThyJBhw5Tf9X3YEtJxe6Xp7A3QBTSd5cU0jz3f69I X-Received: by 2002:a17:902:f215:: with SMTP id gn21mr24426445plb.146.1556141610096; Wed, 24 Apr 2019 14:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556141610; cv=none; d=google.com; s=arc-20160816; b=EuhGtararEVmmviu6mTpJoxXdhiwMMG6nicBjPYDs6V5r545xPXAzkNqLCYAUTu1Od Gh1DP3OLDg7CmrR9d3jrawLY8MWCoIOQ0ujAHKpt/AIWsmfOUvo8qHv0HpO/C+za3mgH 9ZLpFlZl5KTNEXFsvR6fI42MRc6fgEERxDAM9/oxQXOrbml6tOuXEeyto6od5s3Qqqax xz5hEzR49Q7rr2dCkYKQjkyCmpSU+wC03x7odWfnCUr/awnHf/GMbtj5EgnKB+pRYAgm VW+dFv3UoP+i+55xp8w1cy/w9rlmy9MNSK5rm8hq+ZapQQ0jTHzJninO93MLErOl9i8V 5u1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=bJQEIOUyGC9QCXMihF5ETMO6w6LfdXskDZG3ee8y/jo=; b=FjMiiNL8eA24Q9BM3HNNIDoHfQ4Qx5jca+OY2pSfFX5IjPBwV1oDP/YlklAC8omsDW FHtTjOvamoDjwv0cJEyyHbdfgZgdNx4j8tfiq710KOYZyYlBAGRqGU2WWLafpP8SQxPZ 0wM3PLsficxjgmC36t1KDreNk3zbWBqbU2CiAMDXxGZyH69dyGR9ruVLQ3Sg5bWR8Ck+ Jag/chvQUxAePSXqsvu1pChPy41FURxlC3Sls1wMyCYk5PjDQpZEJIOhVodsZvu4pPAc D8jIOzN1S7JvbJqZZ6yZ86Xf5PtsOo8i50yz937hhEFPXqVxZikrLePeDaqcm/DK906l 7tJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=nvJXnldU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f127si20375772pfc.176.2019.04.24.14.33.14; Wed, 24 Apr 2019 14:33:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=nvJXnldU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731828AbfDXPvU (ORCPT + 99 others); Wed, 24 Apr 2019 11:51:20 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:29044 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730625AbfDXPvT (ORCPT ); Wed, 24 Apr 2019 11:51:19 -0400 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x3OFgB5s003581; Wed, 24 Apr 2019 17:51:10 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=STMicroelectronics; bh=bJQEIOUyGC9QCXMihF5ETMO6w6LfdXskDZG3ee8y/jo=; b=nvJXnldUnFHJefhCeS96gK2Ebqx072PGequqWA7i8kzLv1bQzNuwjc8rTxWSI4jSA/FD MJqxmip8TeE8PXukTrgxf3uxZ9gej/nC+B8wxQgzS+GAEbbZoppioSYQsZfZYPDVgMYU nlo5pg1FIhFZDkLtFQ1sHn5aFqwWMKts/q45DPsabSdMr5WjniEI53p92B4a7En80j0v qU+cRl+lZaO0pUppkS8QniHz68j9/NcUN+cYoNxyPMrLayPmUqCMmI2f4kg8QqV1xAkA d9Qgo72YCSukuK8+wYEj8eLeD3e9E2hzWDL/riI8NuHAhghGvrEr5ZqH4EaRBBlnood2 3A== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2ryrvxef5n-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 24 Apr 2019 17:51:10 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 25B0631; Wed, 24 Apr 2019 15:51:10 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas24.st.com [10.75.90.94]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 07619298E; Wed, 24 Apr 2019 15:51:10 +0000 (GMT) Received: from SAFEX1HUBCAS23.st.com (10.75.90.47) by Safex1hubcas24.st.com (10.75.90.94) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 24 Apr 2019 17:51:09 +0200 Received: from localhost (10.201.23.25) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 24 Apr 2019 17:51:08 +0200 From: Fabien Dessenne To: Jassi Brar , Maxime Coquelin , Alexandre Torgue , , , CC: Fabien Dessenne Subject: [PATCH] mailbox: stm32-ipcc: check invalid irq Date: Wed, 24 Apr 2019 17:51:05 +0200 Message-ID: <1556121065-14487-1-git-send-email-fabien.dessenne@st.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.201.23.25] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-04-24_09:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On failure of_irq_get() returns a negative value or zero, which is not handled as an error in the existing implementation. Instead of using this API, use platform_get_irq() that returns exclusively a negative value on failure. Also, do not output an error log in case of defer probe error. Signed-off-by: Fabien Dessenne --- drivers/mailbox/stm32-ipcc.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/mailbox/stm32-ipcc.c b/drivers/mailbox/stm32-ipcc.c index 210fe50..f91dfb1 100644 --- a/drivers/mailbox/stm32-ipcc.c +++ b/drivers/mailbox/stm32-ipcc.c @@ -8,9 +8,9 @@ #include #include #include +#include #include #include -#include #include #include @@ -240,9 +240,11 @@ static int stm32_ipcc_probe(struct platform_device *pdev) /* irq */ for (i = 0; i < IPCC_IRQ_NUM; i++) { - ipcc->irqs[i] = of_irq_get_byname(dev->of_node, irq_name[i]); + ipcc->irqs[i] = platform_get_irq_byname(pdev, irq_name[i]); if (ipcc->irqs[i] < 0) { - dev_err(dev, "no IRQ specified %s\n", irq_name[i]); + if (ipcc->irqs[i] != -EPROBE_DEFER) + dev_err(dev, "no IRQ specified %s\n", + irq_name[i]); ret = ipcc->irqs[i]; goto err_clk; } @@ -263,9 +265,10 @@ static int stm32_ipcc_probe(struct platform_device *pdev) /* wakeup */ if (of_property_read_bool(np, "wakeup-source")) { - ipcc->wkp = of_irq_get_byname(dev->of_node, "wakeup"); + ipcc->wkp = platform_get_irq_byname(pdev, "wakeup"); if (ipcc->wkp < 0) { - dev_err(dev, "could not get wakeup IRQ\n"); + if (ipcc->wkp != -EPROBE_DEFER) + dev_err(dev, "could not get wakeup IRQ\n"); ret = ipcc->wkp; goto err_clk; } -- 2.7.4