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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 54D87C433EF for ; Sat, 5 Feb 2022 23:10:34 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B622E83A69; Sun, 6 Feb 2022 00:10:32 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=openbsd.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=kpnmail.nl header.i=@kpnmail.nl header.b="T/PncIVx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 257F183B58; Sun, 6 Feb 2022 00:10:31 +0100 (CET) Received: from ewsoutbound.kpnmail.nl (ewsoutbound.kpnmail.nl [195.121.94.170]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 87CE58368E for ; Sun, 6 Feb 2022 00:10:28 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=openbsd.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=kettenis@openbsd.org X-KPN-MessageId: c9f01fad-86d8-11ec-8147-005056ab378f Received: from smtp.kpnmail.nl (unknown [10.31.155.38]) by ewsoutbound.so.kpn.org (Halon) with ESMTPS id c9f01fad-86d8-11ec-8147-005056ab378f; Sun, 06 Feb 2022 00:10:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kpnmail.nl; s=kpnmail01; h=mime-version:message-id:date:subject:to:from; bh=KqzBbnoAb1Aj5Tm+0BBKKljwu191EJltcej4zFtJFqY=; b=T/PncIVxtD/iiT84fZ3Yxyk3mOHtrfoLm6TDsTWFRo8OGt/y9GenLZxz7mZngnrCqwLzfn3nmeam4 SGdBt0fpC61c6h+ZDsNWJOtZUrJfkJR8bmdhEQNGTgQHD4ktJe5zNEiV+exiolv21fizVHWBSq7Rv3 5nFuTVz5p6Zpffv0= X-KPN-VerifiedSender: No X-CMASSUN: 33|qxn72+lO+cS+EhMRw4ZSqWwJWXpmoUamEEQwuG8XbMFRxlokjNBsj7WtmhR22Oi QVxd+DnfzJ97Dcs/20n4GjQ== X-Originating-IP: 83.163.83.176 Received: from copland.sibelius.xs4all.nl (sibelius.xs4all.nl [83.163.83.176]) by smtp.xs4all.nl (Halon) with ESMTPSA id ce6330d5-86d8-11ec-a3ee-005056abf0db; Sun, 06 Feb 2022 00:10:27 +0100 (CET) From: Mark Kettenis To: u-boot@lists.denx.de Cc: sjg@chromium.org, Mark Kettenis Subject: [PATCH] drivers: serial: Make sure we really return a serial device Date: Sun, 6 Feb 2022 00:10:18 +0100 Message-Id: <20220205231018.3050-1-kettenis@openbsd.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean The stdout-path property in the device tree does not necessarily point at a serial device. The code that binds the device if it isn't marked to be bound before relocation does not check whether the device really is a serial device. So check that its uclass is UCLASS_SERIAL before probing it. Signed-off-by: Mark Kettenis --- drivers/serial/serial-uclass.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index 96a1cb65ba..931a90bdbd 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -66,7 +66,8 @@ static int serial_check_stdout(const void *blob, struct udevice **devp) */ if (node > 0 && !lists_bind_fdt(gd->dm_root, offset_to_ofnode(node), devp, NULL, false)) { - if (!device_probe(*devp)) + if (device_get_uclass_id(*devp) == UCLASS_SERIAL && + !device_probe(*devp)) return 0; } -- 2.34.1