From patchwork Thu Apr 23 18:59:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 185743 Delivered-To: patches@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp2411680ilf; Thu, 23 Apr 2020 11:59:49 -0700 (PDT) X-Received: by 2002:a63:7f1b:: with SMTP id a27mr3056663pgd.330.1587668389572; Thu, 23 Apr 2020 11:59:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587668389; cv=none; d=google.com; s=arc-20160816; b=pRu/ZBDeinKMpil/ymwks8ryE8UAXlhh+YnwIbe+Udh2un2aoTRt2HuQ0AlSt0KX8F C0JH47aLBzYVxQQ1Gd4J4/E0xCOVBDlnH2ubQKgFJZmQ1oUVvysgaAJoy4bwAsUDosjN osgQqIYtmw3/agqEANcLrhH/HxDV1nLC6z+DmtLQSJHo8xYOVaBwzVe9H8afdlEBByg5 0e12hYHUzHxA+lYAgN+Jx3+YWzE5UdxhR0FNEeLzQCd0J4l21BKB3lMQ/P9L+uUM5f2z s036v/5HPDZeBdVSLpXkYBFxxlMmteoZP8iZe1BMkUPqvqAYLXgRS7rUDQun1xcnuzTb d4gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:to:from:dkim-signature; bh=NJCPN5FpbmsVDsGvhvjf8ltG7Vg+36U7t2aGS4UvwAQ=; b=TJQgYtCxkWGF3Qrrdwales3xIisEXWQeF2+Txc82ofJQTmiEyFnTfc/1w3prtzy9Eh 4pavkI+6ByVEHXQxzA6DQXeubpZnotNTPALjHb6/fgXsRGwMq/kSiQyNcJ1dBrfcIMm+ 1lxyHBJHFIxc+j7GxnZ9sj4WgVJzMEn+HjnuMCtDa0YO6S42iqDcoCpn5WR8G34QMmKg O0ofW2KBgJCfI9HfrAo0u+qg4/RSsVbpGpCuLoP5h0zde/EIim73HJ3eiRwLGXqelZi3 e7wMZe5jR1oXu62wLLYRTR+oDJXX9hWWMYJ04NwZlIAlgF2oGMAp4dsR60r+Ix05JwoB tXFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T8Om4tzw; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id t19sor4762541plo.22.2020.04.23.11.59.49 for (Google Transport Security); Thu, 23 Apr 2020 11:59:49 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T8Om4tzw; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id; bh=NJCPN5FpbmsVDsGvhvjf8ltG7Vg+36U7t2aGS4UvwAQ=; b=T8Om4tzwh1fQ+KEvrcmX223tvC1OxQec0FkrVIde9LwmqV/i7ztypIONjlh41lvy1A xO/wx7DWz5xLxs4gU6JjxzoijWHnedRV4gfN+b9Aqu0hymoMHLWAWBDne9yl2V6+k5Zs ydRK+mYOVFfkzVZo0Sy5DfVWx8Wf99dwy6a27EtxMKh6aNK3xT7oIq/0JvFGuOaWJQzT pmCphaNXkdZFVZ3FikuMAaScRiZY22Y3cVRcPVS2DcdxFcZH9OrYDllEmsn0X5f9eFYP F+cgq3QmqHygS91zPgYQe0DZI0x9pm2uBaI5oWScrC5bE6D2GY2BYK1UbP6XDnP9sQy3 ZExA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=NJCPN5FpbmsVDsGvhvjf8ltG7Vg+36U7t2aGS4UvwAQ=; b=uDYWSVTo7PnL8wjKK18TdbPVkd6D62FamRrd1RZ1FGGHFAoB7rHz6OWzZPq9OeDGpL zjFf+Itc/3mSa74P1wQo3riSq5pxtbRiN9AvIckTeQYHBWaCU1XlVl2bibbpcS2utDi9 fHUo8J5YYUouOqOCXlpnOd57s9ZGRa/YvAyOgMVha+JIyoJ12nxl0t48yiFm8jHDtahX bcGpW7QMQmZUv21p0Wn7yFzUd5SuFvwFRk2OFDtwTGtWzWuwGXtPsYlpJMRt87TaGLDf kF+XBwPErY1Q13jSKqnx2T7QeR8yHzNDsUmWgH7NKy0h+3WNEymBSnQvxYRXFbKZd7a+ XR5A== X-Gm-Message-State: AGi0Pua82NBMWPh5oTgnMlAjDYdqoW7TrsDu/US3uhmplQBaPQJV0jS0 SwVGjXSJX2mQeqzqWVjCSI9wyxlT6Bu7mA== X-Google-Smtp-Source: APiQypI1AJyhjcvKM8K+LGZ6WXziuBDnlJrjvdGpmFt4xiG9IdLtZm9I/VN5fIlBp5apaRyGfoc8kA== X-Received: by 2002:a17:902:9044:: with SMTP id w4mr5273451plz.83.1587668388955; Thu, 23 Apr 2020 11:59:48 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id e22sm2715184pgh.14.2020.04.23.11.59.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 11:59:48 -0700 (PDT) From: John Stultz To: Valentin Schneider Subject: [PATCH] serial: amba-pl011: Make sure we initialize the port.lock spinlock Date: Thu, 23 Apr 2020 18:59:46 +0000 Message-Id: <20200423185946.77515-1-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 Valentine reported seeing: [ 3.626638] INFO: trying to register non-static key. [ 3.626639] the code is fine but needs lockdep annotation. [ 3.626640] turning off the locking correctness validator. [ 3.626644] CPU: 7 PID: 51 Comm: kworker/7:1 Not tainted 5.7.0-rc2-00115-g8c2e9790f196 #116 [ 3.626646] Hardware name: HiKey960 (DT) [ 3.626656] Workqueue: events deferred_probe_work_func [ 3.632476] sd 0:0:0:0: [sda] Optimal transfer size 8192 bytes not a multiple of physical block size (16384 bytes) [ 3.640220] Call trace: [ 3.640225] dump_backtrace+0x0/0x1b8 [ 3.640227] show_stack+0x20/0x30 [ 3.640230] dump_stack+0xec/0x158 [ 3.640234] register_lock_class+0x598/0x5c0 [ 3.640235] __lock_acquire+0x80/0x16c0 [ 3.640236] lock_acquire+0xf4/0x4a0 [ 3.640241] _raw_spin_lock_irqsave+0x70/0xa8 [ 3.640245] uart_add_one_port+0x388/0x4b8 [ 3.640248] pl011_register_port+0x70/0xf0 [ 3.640250] pl011_probe+0x184/0x1b8 [ 3.640254] amba_probe+0xdc/0x180 [ 3.640256] really_probe+0xe0/0x338 [ 3.640257] driver_probe_device+0x60/0xf8 [ 3.640259] __device_attach_driver+0x8c/0xd0 [ 3.640260] bus_for_each_drv+0x84/0xd8 [ 3.640261] __device_attach+0xe4/0x140 [ 3.640263] device_initial_probe+0x1c/0x28 [ 3.640265] bus_probe_device+0xa4/0xb0 [ 3.640266] deferred_probe_work_func+0x7c/0xb8 [ 3.640269] process_one_work+0x2c0/0x768 [ 3.640271] worker_thread+0x4c/0x498 [ 3.640272] kthread+0x14c/0x158 [ 3.640275] ret_from_fork+0x10/0x1c Which seems to be due to the fact that after allocating the uap structure, the pl011 code doesn't initialize the spinlock. This patch fixes it by initializing the spinlock and the warning has gone away. CC: Valentin Schneider Cc: Russell King Cc: Greg Kroah-Hartman Cc: Jiri Slaby Cc: linux-serial@vger.kernel.org Reported-by: Valentin Schneider Signed-off-by: John Stultz Change-Id: Ifd5a8d141e07ef697b435c7a57d5af06f275bdf7 --- drivers/tty/serial/amba-pl011.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.17.1 diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 2296bb0f9578..cb7056db0f51 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2705,6 +2705,8 @@ static int sbsa_uart_probe(struct platform_device *pdev) if (!uap) return -ENOMEM; + spin_lock_init(&uap->port.lock); + ret = platform_get_irq(pdev, 0); if (ret < 0) return ret;