From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E91DDC004C0 for ; Sat, 21 Oct 2023 16:17:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=g4jYb0+jGhqbYeuLdHZoidjIACwrxdI+/FLUScPq0wg=; b=ENPk0gM6SFd5Bn 4CrPsffbX6vNWUGSWhooenqvugCd7s5IA20rS3t9EcWYZlICTlaeQivkQGKVD/drqOgaQqVryaEav FErHiMHgxWJSjP4Aqpk7paNkYBIPmQnE6mzZWjHB+2xHHeIL3SKNUt54sF4NST0N0I/tlVNfhs00E uHM81C2+d/eO/xrdmNjwdkC2PDOwQNN6lduYV1/emfvZUglT6QdJnR0ok3SLkykd70CDtM9KtT4cO WBUzy3mf4XlWY3WFNq8KDxsY7kZmcXHqU1QrLkpIE/Nb+6C4UNpWm2qcCMMf6073mNF56iROv6Vrb rP8u5JB+ulEI2Eqlz3lA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1quEeY-004E4E-2F; Sat, 21 Oct 2023 16:16:42 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1quEeT-004E3k-1H for linux-arm-kernel@lists.infradead.org; Sat, 21 Oct 2023 16:16:41 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 43871B80E53; Sat, 21 Oct 2023 16:16:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40660C433C7; Sat, 21 Oct 2023 16:16:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1697904994; bh=y4JFskdrUwYNiP1nwcKVRAOGFpDPCC07UojewYpv2LU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PckH0S4EPdrTxuwrkbrEsB0ddV8JC6noeyRjJvyIXa69iv1+p1d8gqVP+H8PFgmLX 0ieYjQAXUHlZ/8XVk8YO93lRzqEC1rlv7pQcn/PzyGM02jLdBWzk8SjazvVkdOw/FX 9WEIbbPqeXmbmnmYTGRRVtEeXZoKIoN87CSPkqqE= Date: Sat, 21 Oct 2023 18:16:32 +0200 From: Greg KH To: Yi Yang Subject: Re: [PATCH] serial: atmel: Check return value of platform_get_irq() in atmel_init_port() Message-ID: <2023102151-mobster-reappoint-99da@gregkh> References: <20231018091521.314706-1-yiyang13@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231018091521.314706-1-yiyang13@huawei.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231021_091637_589882_048C9F04 X-CRM114-Status: GOOD ( 17.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.belloni@bootlin.com, claudiu.beznea@tuxon.dev, linux-serial@vger.kernel.org, jirislaby@kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Oct 18, 2023 at 09:15:21AM +0000, Yi Yang wrote: > The platform_get_irq() might be failed and return a negative result, there > should be return an error code when platform_get_irq() failed. > Fix it by add check return value of platform_get_irq(). > > Fixes: 5bb221b0ad65 ("serial: atmel: Use platform_get_irq() to get the interrupt") > Signed-off-by: Yi Yang > --- > drivers/tty/serial/atmel_serial.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c > index 1946fafc3f3e..4984bec88445 100644 > --- a/drivers/tty/serial/atmel_serial.c > +++ b/drivers/tty/serial/atmel_serial.c > @@ -2540,13 +2540,17 @@ static int atmel_init_port(struct atmel_uart_port *atmel_port, > atmel_init_property(atmel_port, pdev); > atmel_set_ops(port); > > + ret = platform_get_irq(mpdev, 0); > + if (ret < 0) > + return 0; > + > port->iotype = UPIO_MEM; > port->flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP; > port->ops = &atmel_pops; > port->fifosize = 1; > port->dev = &pdev->dev; > port->mapbase = mpdev->resource[0].start; > - port->irq = platform_get_irq(mpdev, 0); > + port->irq = ret; Sorry, no, this makes things much more complex and error-prone in the long term, for a function that in reality, never fails (obviously otherwise this would have been reported.) How did you test this? thanks, greg k-h _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel