Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp731032ybt; Wed, 1 Jul 2020 08:42:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTsLlkh+4Dyt2VN9UfJsGIu/mOuUnugI8pdOR4HR87YBQGYZyp70CZLIuaCU8xhhaCiENB X-Received: by 2002:a17:906:1f0d:: with SMTP id w13mr24567612ejj.0.1593618159833; Wed, 01 Jul 2020 08:42:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593618159; cv=none; d=google.com; s=arc-20160816; b=cF7+7MknzVLRa7qdQZAeDCyx/2rZWT007gDCfraSLm426uwO9/7Dy6WUmZ1k/atJ3X o5YSQ4Dcoe3LxkFbrXRCCoOyLthZtzZDQpkagjFZsx+eAqqHMgRvrSyMHSEWPtpPKWkF bP0YTHjzzFspexbhMiNPZzCm/105rASnlftBvB2HHZ6PROdXT+Am3vYv7HUWhrcGSgWG JchGSj0NJsvLQV5sutlLAio5wAWPy1ekvMXUwFvlpmfA7OAm8y/Yo07kr1GijUdVMwHj Wv5pH00U2clzmphWrvQiv4MyVItUbqtBp4G+aApFUCuA+y7O8+/ZxgOsZq0B2B0VPnho eXmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=jNTZddJs9Z8yPpjHc6oiWPQWVdD+ulAs5snlMTtEqtI=; b=irz0z/cLBhswckwxSOKkBlmPd1Ej2zS0pRXoary7kkVwK5hjPqeUaCEZydyn5xIv9V kLpIe47J9kdXNRCbSGGx7NFd6O3sQdWoCCfeikKx6nkbc1MJ/wob8bfjuQQnH5K7bSBu DGpcMfjtBkrwIi/cLZgCaDb2w2aBfQybS4S0JHB8PsDPGo+AXebyIFtlixL5Gcc34i/E e0BDf9RUcgmpG4bFzQlGzs6rNXeDA+hUV8yUFNo8eVhrYJlaaBZIVebQR6gRcBRVzWUx qo78JCOTFNC3/3hJdnenBFkaKWv1BMiGNU84k+jIBLTftdPyfOdnDf930M5epVpG4CYd uTvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v6si3932056eje.743.2020.07.01.08.42.16; Wed, 01 Jul 2020 08:42:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731763AbgGAPmH (ORCPT + 99 others); Wed, 1 Jul 2020 11:42:07 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:34032 "EHLO relmlie6.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731441AbgGAPmG (ORCPT ); Wed, 1 Jul 2020 11:42:06 -0400 X-IronPort-AV: E=Sophos;i="5.75,300,1589209200"; d="scan'208";a="50853456" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 02 Jul 2020 00:42:04 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 2F082400CE8B; Thu, 2 Jul 2020 00:42:01 +0900 (JST) From: Lad Prabhakar To: Geert Uytterhoeven , Greg Kroah-Hartman , Jiri Slaby Cc: linux-renesas-soc@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Lad Prabhakar Subject: [PATCH] serial: sh-sci: Initialize spinlock for uart console Date: Wed, 1 Jul 2020 16:41:40 +0100 Message-Id: <1593618100-2151-1-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org serial core expects the spinlock to be initialized by the controller driver for serial console, this patch makes sure the spinlock is initialized, fixing the below issue: [ 0.865928] BUG: spinlock bad magic on CPU#0, swapper/0/1 [ 0.865945] lock: sci_ports+0x0/0x4c80, .magic: 00000000, .owner: /-1, .owner_cpu: 0 [ 0.865955] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.8.0-rc1+ #112 [ 0.865961] Hardware name: HopeRun HiHope RZ/G2H with sub board (DT) [ 0.865968] Call trace: [ 0.865979] dump_backtrace+0x0/0x1d8 [ 0.865985] show_stack+0x14/0x20 [ 0.865996] dump_stack+0xe8/0x130 [ 0.866006] spin_dump+0x6c/0x88 [ 0.866012] do_raw_spin_lock+0xb0/0xf8 [ 0.866023] _raw_spin_lock_irqsave+0x80/0xa0 [ 0.866032] uart_add_one_port+0x3a4/0x4e0 [ 0.866039] sci_probe+0x504/0x7c8 [ 0.866048] platform_drv_probe+0x50/0xa0 [ 0.866059] really_probe+0xdc/0x330 [ 0.866066] driver_probe_device+0x58/0xb8 [ 0.866072] device_driver_attach+0x6c/0x90 [ 0.866078] __driver_attach+0x88/0xd0 [ 0.866085] bus_for_each_dev+0x74/0xc8 [ 0.866091] driver_attach+0x20/0x28 [ 0.866098] bus_add_driver+0x14c/0x1f8 [ 0.866104] driver_register+0x60/0x110 [ 0.866109] __platform_driver_register+0x40/0x48 [ 0.866119] sci_init+0x2c/0x34 [ 0.866127] do_one_initcall+0x88/0x428 [ 0.866137] kernel_init_freeable+0x2c0/0x328 [ 0.866143] kernel_init+0x10/0x108 [ 0.866150] ret_from_fork+0x10/0x18 Signed-off-by: Lad Prabhakar Reviewed-by: Biju Das --- drivers/tty/serial/sh-sci.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index ae8463a..2d3169f 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -3298,6 +3298,9 @@ static int sci_probe_single(struct platform_device *dev, sciport->port.flags |= UPF_HARD_FLOW; } + if (sci_uart_driver.cons->index == sciport->port.line) + spin_lock_init(&sciport->port.lock); + ret = uart_add_one_port(&sci_uart_driver, &sciport->port); if (ret) { sci_cleanup_single(sciport); -- 2.7.4