From patchwork Sat Aug 26 09:32:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 717713 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 EC891C83F01 for ; Sat, 26 Aug 2023 09:33:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232240AbjHZJdG (ORCPT ); Sat, 26 Aug 2023 05:33:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232252AbjHZJci (ORCPT ); Sat, 26 Aug 2023 05:32:38 -0400 Received: from out203-205-221-210.mail.qq.com (out203-205-221-210.mail.qq.com [203.205.221.210]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAEF81BD9; Sat, 26 Aug 2023 02:32:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1693042349; bh=ENxAcgMLJj+l/WH28kfC2QbyQgKt+/UZ1l+NFjDswjI=; h=From:To:Cc:Subject:Date; b=myT+cyeEYni0Nsw3J916Rxr0pk4vXLmLx5wUXUUnca9Mg2CTxWYuMq7vWb73Jc7f0 0rtTf/M9KZ+jvgnHL1nGBN/KlT76FJhHYtNlBVtLA8X4G8idBcuPMt/EJnQE7Jn24V 7LllCYB8ZcpJK+1AmEBu5UldFrEUNKepmFHh0u9E= Received: from KernelDevBox.byted.org ([180.184.51.70]) by newxmesmtplogicsvrszb9-0.qq.com (NewEsmtp) with SMTP id 81B0E42E; Sat, 26 Aug 2023 17:32:27 +0800 X-QQ-mid: xmsmtpt1693042347t4nhuq2rn Message-ID: X-QQ-XM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8w= From: Zhang Shurong To: gregkh@linuxfoundation.org Cc: jslaby@suse.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Shurong Subject: [PATCH] tty: serial: linflexuart: Fix to check return value of platform_get_irq() in linflex_probe() Date: Sat, 26 Aug 2023 17:32:24 +0800 X-OQ-MSGID: <20230826093224.2150838-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: 09864c1cdf5c ("tty: serial: Add linflexuart driver for S32V234.") Signed-off-by: Zhang Shurong --- drivers/tty/serial/fsl_linflexuart.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/fsl_linflexuart.c b/drivers/tty/serial/fsl_linflexuart.c index 3e28be402aef..7a7461543bb4 100644 --- a/drivers/tty/serial/fsl_linflexuart.c +++ b/drivers/tty/serial/fsl_linflexuart.c @@ -850,10 +850,14 @@ static int linflex_probe(struct platform_device *pdev) if (IS_ERR(sport->membase)) return PTR_ERR(sport->membase); + ret = platform_get_irq(pdev, 0); + if (ret < 0) + return ret; + sport->dev = &pdev->dev; sport->type = PORT_LINFLEXUART; sport->iotype = UPIO_MEM; - sport->irq = platform_get_irq(pdev, 0); + sport->irq = ret; sport->ops = &linflex_pops; sport->flags = UPF_BOOT_AUTOCONF; sport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_FSL_LINFLEXUART_CONSOLE);