Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5381048pxb; Mon, 7 Feb 2022 00:13:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJwEj1sRVFhXTpigigT20G5QdM/R9Vg4yP+jYp5M9HoG+Ctksx/s1Gd+Yz0qTbY+scKyFfmv X-Received: by 2002:aa7:9634:: with SMTP id r20mr14411514pfg.57.1644221611660; Mon, 07 Feb 2022 00:13:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644221611; cv=none; d=google.com; s=arc-20160816; b=Ho31Hefq6+aO7xRC7TlqztA90JJDntjgmlZ87gsNW1DvwltMyy6DICZmfGspTMkNeJ p1EjqbE5VYvuCiUhD9WmMJx0VfGUjjbG6SKjLrE8xEyUETuwEPDs2pCcfh6v1BXjlEk4 kGFw3aV8kxEfT3oxvuLYrnE4BcAhwWoUaZI2YbOlFqdJpkvBe7ZwyCV0PLHCJ+i2QAQl VvkjyXmklhjyV9/3fON9AP7XKHJdPa5Rr4zsVPjURX7HCWjtEhDyJ+WWk16bFhqhI4wH wFI3RQKamT9OuGz1CZLzUJGhYICDY/8xwgC03dNUQ6hqEr9mSahgQiA7Bqenr++0kEig PTMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=3/3immIUqq/DHcB9iRyY0ciKsvajKYj0OjwWJexqNPU=; b=H7Ur8PEUt4obuMlgCB7bVEZ41lIOyFgjdxp+F5KcJ84YrHE18lcqpuyfcAjIld2vbm fTx4r4vuX/xxDo+I0wrt7G1tXR+mMV/XsXAoRJHUGul1HHsY/1KgNRGXDcA8gFp0ywoA Ry49bIKorP/2SIewzSH18neGQIWDn45JaaXYwvLEsEBd5ew9aLATJFQn6JneW40/ECEr DREdxf4vPUlNOLcTiV8dEKLhXMmPyYnstjDsFdutqzzzot/l1AGIBGIt7EUcyLxtANI6 EVycH8VXIeeJaidU/Ezys1WP/PjMNkVfgloWyuMXd2D/khl/PFTeNmX5TiY9JqgywesC gXsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 2si8462040pfz.122.2022.02.07.00.13.19; Mon, 07 Feb 2022 00:13:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238943AbiBFQ2R (ORCPT + 99 others); Sun, 6 Feb 2022 11:28:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233293AbiBFQ2P (ORCPT ); Sun, 6 Feb 2022 11:28:15 -0500 Received: from out30-43.freemail.mail.aliyun.com (out30-43.freemail.mail.aliyun.com [115.124.30.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 562E8C06173B; Sun, 6 Feb 2022 08:28:14 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=xuyu@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0V3h3zbK_1644164890; Received: from localhost(mailfrom:xuyu@linux.alibaba.com fp:SMTPD_---0V3h3zbK_1644164890) by smtp.aliyun-inc.com(127.0.0.1); Mon, 07 Feb 2022 00:28:11 +0800 From: Xu Yu To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: arnd@arndb.de, gregkh@linuxfoundation.org, viro@zeniv.linux.org.uk, dhowells@redhat.com Subject: [PATCH] chardev: call tty_init() in real chrdev_init() Date: Mon, 7 Feb 2022 00:27:31 +0800 Message-Id: <4e753e51d0516413fbf557cf861d654ca73486cc.1644164597.git.xuyu@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.2432.ga663e714 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is confusing that tty_init() in called in the initialization of memdev, i.e., static chr_dev_init(). Through blame, it is introduced by commit 31d1d48e199e ("Fix init ordering of /dev/console vs callers of modprobe"), which fixes the initialization order of /dev/console driver. However, there seems to be a typo in the patch, i.e., chrdev_init, instead of chr_dev_init. This fixes the typo, IIUC. Note that the return value of tty_init() is always 0, and thus no error handling is provided in chrdev_init(). Fixes: 31d1d48e199e ("Fix init ordering of /dev/console vs callers of modprobe") Signed-off-by: Xu Yu --- drivers/char/mem.c | 2 +- fs/char_dev.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/char/mem.c b/drivers/char/mem.c index cc296f0823bd..8c90881f8115 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c @@ -775,7 +775,7 @@ static int __init chr_dev_init(void) NULL, devlist[minor].name); } - return tty_init(); + return 0; } fs_initcall(chr_dev_init); diff --git a/fs/char_dev.c b/fs/char_dev.c index ba0ded7842a7..fc042a0a098f 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c @@ -667,6 +667,7 @@ static struct kobject *base_probe(dev_t dev, int *part, void *data) void __init chrdev_init(void) { cdev_map = kobj_map_init(base_probe, &chrdevs_lock); + tty_init(); } -- 2.20.1.2432.ga663e714