From patchwork Sat Aug 26 07:54:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 717367 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32C48C83F16 for ; Sat, 26 Aug 2023 08:01:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229901AbjHZIAj (ORCPT ); Sat, 26 Aug 2023 04:00:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229746AbjHZIAM (ORCPT ); Sat, 26 Aug 2023 04:00:12 -0400 Received: from out203-205-221-209.mail.qq.com (out203-205-221-209.mail.qq.com [203.205.221.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC8D110EF; Sat, 26 Aug 2023 01:00:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1693036505; bh=yLUzFJjhb3rHZwHXuc55nQDUf3m7AuJZLDcqiQ2yCBg=; h=From:To:Cc:Subject:Date; b=SFU+xvWJ1V47dFuXlPU2GqPk7ZhK2/Oo3x8qUKGO4BMAGZJSAMxvrZ/kBOfz5gtaP gvx2qWVBny9EOz6AEv137w0jcdhQ8/F6H1fecCd6uhMFVFm2nyH6MsVpwKr674cwMT LS+hj/9wtUfw043MwJxVlSpgrUckemrNcp1Ev5e4= Received: from KernelDevBox.byted.org ([180.184.51.134]) by newxmesmtplogicsvrszc2-1.qq.com (NewEsmtp) with SMTP id DC294ED4; Sat, 26 Aug 2023 15:55:02 +0800 X-QQ-mid: xmsmtpt1693036502ts34msnz1 Message-ID: X-QQ-XMAIL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I0nM X-QQ-XMRINFO: Nq+8W0+stu50PRdwbJxPCL0= From: Zhang Shurong To: patrice.chotard@st.com Cc: gregkh@linuxfoundation.org, jslaby@suse.com, linux-arm-kernel@lists.infradead.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Shurong Subject: [PATCH v2] serial: st-asc: Fix to check return value of platform_get_irq() in asc_init_port() Date: Sat, 26 Aug 2023 15:54:59 +0800 X-OQ-MSGID: <20230826075459.2014059-1-zhang_shurong@foxmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org The platform_get_irq might be failed and return a negative result. So there should have an error handling code. Fixed this by adding an error handling code. Fixes: c4b058560762 ("serial:st-asc: Add ST ASC driver.") Signed-off-by: Zhang Shurong --- v1->v2: generated patch based on tty-next tree. drivers/tty/serial/st-asc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c index e7048515a79c..3d60ab6e9581 100644 --- a/drivers/tty/serial/st-asc.c +++ b/drivers/tty/serial/st-asc.c @@ -723,9 +723,13 @@ static int asc_init_port(struct asc_port *ascport, port->ops = &asc_uart_ops; port->fifosize = ASC_FIFO_SIZE; port->dev = &pdev->dev; - port->irq = platform_get_irq(pdev, 0); port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_ST_ASC_CONSOLE); + ret = platform_get_irq(pdev, 0); + if (ret < 0) + return ret; + port->irq = ret; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); port->membase = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(port->membase))