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 mail.kernel.org (mail.kernel.org [198.145.29.99]) (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 382C0C433F5 for ; Fri, 19 Nov 2021 20:25:23 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 6343561AA2 for ; Fri, 19 Nov 2021 20:25:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6343561AA2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A3BBC83753; Fri, 19 Nov 2021 21:24:49 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.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; unprotected) header.d=chromium.org header.i=@chromium.org header.b="C3H4qMKC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1A6FA83769; Fri, 19 Nov 2021 21:24:38 +0100 (CET) Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 86DEA83685 for ; Fri, 19 Nov 2021 21:24:23 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ot1-x331.google.com with SMTP id w6-20020a9d77c6000000b0055e804fa524so18455504otl.3 for ; Fri, 19 Nov 2021 12:24:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Mgdb6xCZGnlgyMJkZMa1lza78jzCk0XZruy/fdS1VkM=; b=C3H4qMKCyMaek0R8ZdtzFfGjALbjb6nM9WBUdZxrXrwDtlQyNMJeNyEYkhB41VFgCL SaeTqrnZULprFw0YnAkxhOLEnjmU/RbQ3asVhxwEqvSH1+sbWTHMS8w9eqCC/KYuV6Bz XfXP74nFpGBezQuDnwIXcYtBUQtmthskmVYEw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Mgdb6xCZGnlgyMJkZMa1lza78jzCk0XZruy/fdS1VkM=; b=Ha44Bl6EXDEusFh9tUs6D7SpvCoRMAA4n9He3jlM3oiGiWHFLWC374AWtN3pLZSBCa jo9NT5h6FXBvlx6y6X+vhq3/cI1ON10eQL/W0u0N0YPMXpY3nfxPYyqh0KrvyQ6POlW8 a6p1fttfkb15lHWLq2dRj/ybCqxufqZVFPo/V9VoGJMNU42q6Pv6c8rR1DzkZEeBkGXU TzCY7K2siGi/hFJ/pTMAaK4O0Icu4yhhgUez6On3cqr7g+4imaz+XFFsR5DwXUhpvi6T EhC1BsaI5kkGylhbr8P+XhpDXmhpQkvBmsJWrkD9L7xDdcIpT8ONcqUupR7clxnpC61i sBLQ== X-Gm-Message-State: AOAM533H+PG6oYZ1KKUytISANVkwLtIzYjrJiqjW52C8PDEukxBoDc6x /f/pbZtXNv7ALiKSBT7E6vc1HU7ha3BnWQ== X-Google-Smtp-Source: ABdhPJypGCedOwpRxnAyehbugilsLGO5ySjExBILcs07ysK+2UrTmzJq0w3VcK0HanrpAay2ZUldcg== X-Received: by 2002:a05:6830:195:: with SMTP id q21mr6987808ota.355.1637353461925; Fri, 19 Nov 2021 12:24:21 -0800 (PST) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id bl33sm197093oib.47.2021.11.19.12.24.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 12:24:21 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Anatolij Gustschin , Tom Rini , Simon Glass , Andy Shevchenko , Patrick Delaunay , Sean Anderson , Steffen Jaeckel Subject: [PATCH 03/23] console: Avoid serial output before the console is running Date: Fri, 19 Nov 2021 13:23:47 -0700 Message-Id: <20211119202408.1815506-4-sjg@chromium.org> X-Mailer: git-send-email 2.34.0.rc2.393.gf8c9666880-goog In-Reply-To: <20211119202408.1815506-1-sjg@chromium.org> References: <20211119202408.1815506-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.37 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.2 at phobos.denx.de X-Virus-Status: Clean The video driver uses this for debugging, but if used before relocation it crashes at present. Avoid trying to output debugging before the console is ready. Signed-off-by: Simon Glass --- common/console.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/console.c b/common/console.c index 0013d183aeb..a9d3319977f 100644 --- a/common/console.c +++ b/common/console.c @@ -348,7 +348,8 @@ static void console_puts_select(int file, bool serial_only, const char *s) void console_puts_select_stderr(bool serial_only, const char *s) { - console_puts_select(stderr, serial_only, s); + if (gd->flags & GD_FLG_DEVINIT) + console_puts_select(stderr, serial_only, s); } static void console_puts(int file, const char *s) @@ -401,7 +402,8 @@ static inline void console_putc(int file, const char c) void console_puts_select(int file, bool serial_only, const char *s) { - if (serial_only == console_dev_is_serial(stdio_devices[file])) + if ((gd->flags & GD_FLG_DEVINIT) && + serial_only == console_dev_is_serial(stdio_devices[file])) stdio_devices[file]->puts(stdio_devices[file], s); } -- 2.34.0.rc2.393.gf8c9666880-goog