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 76294C25B76 for ; Tue, 11 Jun 2024 11:11:52 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc: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=HfinoefB2JPwjYKUKosKARLLC/Yli0ZrzLoN3CGWcsc=; b=nOKZArLg1RSZz2 kQWo0Dnesqk85sdg20+HnXap0HaAFSJsppIKPW7BhnB0O/Dd6ewTCWvty7zCLZPIn+T4+OcijjRtR 0JoVupg6U/qnYwatakxa1erlmQkspZoUPT7M5SK8DBSIEmJDerIczH8TUtt6De4Al7JVu+TCtL5qy JG/79ionbgV7bszJ6i1L8Om2ORVSPJWw60e4sEj73SbhchkuH9504IcuBkgWccnn5VOkkYwTKrM9C WNQhp8AiOz/iNxqErEl9Lg4/+BJz4hrrrP/L5ANkDEfGZCBZRxuXoKs4sQHaufXIFYidYVtjX+UT2 ZqgNTbnzrAPquymtNXBA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sGzPd-00000008aNC-3OL2; Tue, 11 Jun 2024 11:11:41 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sGzPa-00000008aMT-3Tsv for linux-arm-kernel@lists.infradead.org; Tue, 11 Jun 2024 11:11:36 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id A060660CA3; Tue, 11 Jun 2024 11:11:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE3F3C2BD10; Tue, 11 Jun 2024 11:11:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1718104291; bh=uO2OPUhv3WVfU6cyAICdpTmjkXISu/zOdlmZNmHERQ0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=zuR3uEa0eLCEW9zND1Sj/k+K50jXDBWLktOLsKhDNqw+Dk97iYoTPEXRIArFnZWEO +Hs8EG4QEJknysWV53Lt9LsUtEBMHXOh2bbu7kST+Xv3CgmLJhEKGYiXGIYgA2AV/G sZeXjXluJDOiqBh+CtZ7qMtoI2YnLDlNwok0lwlE= Date: Tue, 11 Jun 2024 13:11:28 +0200 From: Greg KH To: Jacky Huang Cc: dan.carpenter@linaro.org, jirislaby@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Jacky Huang Subject: Re: [PATCH] tty: serial: ma35d1: Add a NULL check for of_node Message-ID: <2024061118-sycamore-leggings-05a9@gregkh> References: <20240611092251.159149-1-ychuang570808@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240611092251.159149-1-ychuang570808@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240611_041135_095099_7669F6B2 X-CRM114-Status: GOOD ( 19.95 ) 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: , 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 Tue, Jun 11, 2024 at 09:22:51AM +0000, Jacky Huang wrote: > From: Jacky Huang > > The pdev->dev.of_node can be NULL if the "serial" node is absent. > Add a NULL check to return an error in such cases. > > Signed-off-by: Jacky Huang > --- > drivers/tty/serial/ma35d1_serial.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > > diff --git a/drivers/tty/serial/ma35d1_serial.c b/drivers/tty/serial/ma35d1_serial.c > index 19f0a305cc43..3b4206e815fe 100644 > --- a/drivers/tty/serial/ma35d1_serial.c > +++ b/drivers/tty/serial/ma35d1_serial.c > @@ -688,12 +688,13 @@ static int ma35d1serial_probe(struct platform_device *pdev) > struct uart_ma35d1_port *up; > int ret = 0; > > - if (pdev->dev.of_node) { > - ret = of_alias_get_id(pdev->dev.of_node, "serial"); > - if (ret < 0) { > - dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n", ret); > - return ret; > - } > + if (!pdev->dev.of_node) > + return -ENODEV; > + > + ret = of_alias_get_id(pdev->dev.of_node, "serial"); > + if (ret < 0) { > + dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n", ret); > + return ret; > } > up = &ma35d1serial_ports[ret]; > up->port.line = ret; What commit id does this fix? thanks, greg k-h _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel