Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp269003lqp; Tue, 11 Jun 2024 04:11:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUV/GSBO1ZknQpUqZnUvf7PVd79MCq3Pf7G9k/bN2AO15tfYVzu6qHrk0mJ1IAFLc3NVKoKhefv7mP0uNYmMX2SKTXJUwaOigJWgsfOaQ== X-Google-Smtp-Source: AGHT+IHsFai8ZEfG2+ww9lbXXW50ZL8XbI1Wg86UEU4wBZSWPcXLwgGH5NxxwvAF2/oQJHOUjzIX X-Received: by 2002:a17:90a:ba95:b0:2c3:e99:614f with SMTP id 98e67ed59e1d1-2c30e996295mr4519256a91.37.1718104297850; Tue, 11 Jun 2024 04:11:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718104297; cv=pass; d=google.com; s=arc-20160816; b=ghhgS+vBDjJdyNALwg+TGiqadaac8aE+8WrwfPCCyxI7dKc3+EB8aoB1enzgqF2pbr LNXxQ7iJr6/Ve/sPjbqWTiIG/Y3YtU75jKJ4BuNsDxct4FTBtnf4+kR4uG0yH4VhI5JG 4VPVfHdqVguk2pMkg32baWOI4tkjhVThYQVuJ74BL/eZlDtm6ANeXJMi+9wLCTqDXwmD OVpfaehGzw9kBl9ZVVRidkfBIX5CzqiF0+V3cOGtTJUw7Z7g2Q8AV3ZOHr6tFjvXMcqn PykAr6S8Jv6FWcgGXQZmC68KBTWIe90L5xWNiH+Kd7b3y4+bP+E0zWSZVct3leBiduOZ lNjw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=J6a5AaBMQvJd+679Ds3819A+UfQCNdHsW4eSUlEd22s=; fh=Br73nKN04Fn3lWtsERyLIJlWmyMXYkD1VaDZo/wTIqQ=; b=BjmlN3Ge2n+96d1rzYqfSK694plK2/6GQqn0e+7Rx5QJyBtQw6rfg8JS4y1n2eshO2 GDCsQrCZBwrzL9gDhXY/FFUFXv3wPuGiTb4Ns6c5DdqMovwtYp/pmMoBnpd50IHWelo9 ajlkEkiGup7FYg7Y3wkQb3Nz9/rr5ltv+B2C6bN7qYIj/y8yavASxg22Z+rawEQkJkSI n8jgHrUAEMNsrJleZ2aP0ihWGWJ+8VlETyFuiJnhSd61K1q5GD2dGkhXcGnHovNodQkH loZjW721INEdtn9QlNxGk6hv/BfZH13VxssrVt5rYsnnjQ/NXtSbly+M7nLTRaO431iZ oxmg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zuR3uEa0; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-209708-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209708-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c2d0e79680si6467634a91.78.2024.06.11.04.11.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 04:11:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209708-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zuR3uEa0; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-209708-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209708-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id F16892823F8 for ; Tue, 11 Jun 2024 11:11:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A747717A93B; Tue, 11 Jun 2024 11:11:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="zuR3uEa0" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99F6D179951; Tue, 11 Jun 2024 11:11:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718104291; cv=none; b=B4zotmvbvc0ABkNcUdn3RlPRGrr3TMzV7fjWqzcNCNPTB6jzGdh3UUI/FShCZgmEAQjUdn2+wDafBbz7epuj/MspobVwm+kN2Qkxqu9PD2j3hStCAwFfP7ZioVoKGPwM7apg3jGl0RN3JrlWCO6u0fuHtDf+cfZ1xIhx8v8bLxo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718104291; c=relaxed/simple; bh=uO2OPUhv3WVfU6cyAICdpTmjkXISu/zOdlmZNmHERQ0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NjounMuwQAEgEQMceB/4P6fOmN43MS0RvGczYjdeWK//COXInwBwMx9AXNUGW3fk69HZLNWr+HMR/nbPFd3Ex2rPJNejgfhw0//yUc5bi6pXiNBdrRAqd7d9LSEf3MO1TMmZVdU+03UtA5DkonZN4ZB1dBNL1MPnE8TC/qasX6w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=zuR3uEa0; arc=none smtp.client-ip=10.30.226.201 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240611092251.159149-1-ychuang570808@gmail.com> 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