Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp2194996ima; Thu, 25 Oct 2018 10:59:40 -0700 (PDT) X-Google-Smtp-Source: AJdET5cHhQ1s/+lm8CoO9vTg1u4veDQbUJjGKDHTwTzmGGp2DAELVw0joqPFuIIqupsdfEAAkk0r X-Received: by 2002:a17:902:7041:: with SMTP id h1-v6mr209400plt.306.1540490380577; Thu, 25 Oct 2018 10:59:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540490380; cv=none; d=google.com; s=arc-20160816; b=DxdFe/d8fCjho+JctafygJ17SSqZT/0mf0uF9PQNJ5iWjoTGv6dVjstL19oo+pP3iq G7+3VsvzPukVZH94VIkKJ6DwEpZ7Js38olzIE+vGZvcRabBFpTcXDEvJY/SfU7Kl4ptT klDjdW4+oBcuXqzu6B5rILNNLhffQ7oh9K3Uh/1GyPMNQoq3XbNS1jczLHggA2zCiA8L vy7o6o2fm1k0+BySpVELEViMtcR4EC+N3IgPken8CNRoVwnZrjJT1YYPEBZfm3SB6Osa unm6Np6FjsMa319yRhuFb+ZzPJTF35qM2GHKxpxkth/ZibPhQErnYKsTsZjpU3C3sUMB 5FQg== 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 :dkim-signature; bh=BfPqDKGw3o0KXK8SulRln3sQqjmzSCqI/iaJQG9ROBQ=; b=0EHggL4XaXRd1YvXRhv1LAEWpCH7AishjhyfxtpAd6SkBXUH/ujRoCGUnWJEQGMpBH br5jM655GUqqGox+jo+czkYE2qhTVO9ihRSLk6gMNBcy5HW/kDVN0TJ7V0j+Qc5qIlL5 +AsFc/SaaHnuJ7367AnFbtIHspyDn16ljo45iwpzZwnr2hU4dXgf9fycIvl7lNsTk3Io XP7MtkVNjAscgMt3lOxqRk+MzAvfGX3NcN4T5eNjgi8ujtniOFgYChiWIklCpo/ptj9d iAMKG/xIROfATTV9TQRetjv3pKAkXFAbLXos4dXXsuhncL3KemNR/tyIvYkOXF6dAE7P 7m/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RIJyuP+t; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t26-v6si9546017pgl.273.2018.10.25.10.59.24; Thu, 25 Oct 2018 10:59:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RIJyuP+t; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727721AbeJZCbS (ORCPT + 99 others); Thu, 25 Oct 2018 22:31:18 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:44865 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727588AbeJZCbR (ORCPT ); Thu, 25 Oct 2018 22:31:17 -0400 Received: by mail-pf1-f196.google.com with SMTP id j2-v6so1362835pfn.11 for ; Thu, 25 Oct 2018 10:57:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=BfPqDKGw3o0KXK8SulRln3sQqjmzSCqI/iaJQG9ROBQ=; b=RIJyuP+tj6g+p4R8MLIQZDjLwRuXwA1PMtCy9NT3n4DxhrfZJSIh6QYXcYuhRbARSV XRDOyMZRKk8+zVRXZn7/WvtOlLCeL5gE/I/FOP4Hsfj8ZnGHnbV6ZGYXN9aclQUZeUb/ Gkj182asMJJfL/JShP++JVXaL/FTKGok3Qh9E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=BfPqDKGw3o0KXK8SulRln3sQqjmzSCqI/iaJQG9ROBQ=; b=Au1+BDbvqRjhXAFWqnq/rb1sIXW0mWcUr94/kyvS8ERIXauTJ/CcbSZzwPKNCQJ+19 lxYBo3uAg0n1yCsw7E2h3bP3rMMRDw+amKukO+O4c5elKD7TPpyQMhoHeGgUbMhSLBvU YwwO6DoUIWoWh3YSJ8FwmfePBcEO9Zd3voliAvt63znlRuMBWZsi5YRqePBin9u9iegt VAmXPhgkE2grgO13QnmVCWE4lEIzUHPWoeLEmoi/rFk1/9QxXesARQbzrgM4yS0sEZpA ZoRRXYKt3qMZlqq/jRxqIIbJOTzEJQP6ONJNPstd67H+pdJkbOyRCTiqr1fumLa27tvj h0aQ== X-Gm-Message-State: AGRZ1gKmX3yb3DQT+L333uOC/bdIzaLMM440lG1jM0e+zIF/AJ3Pzxa6 J42mlLmcilpZQZNFpb+WY4eoFkNn0Ko= X-Received: by 2002:a63:4d5d:: with SMTP id n29-v6mr204008pgl.270.1540490247767; Thu, 25 Oct 2018 10:57:27 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id e2-v6sm10239554pgv.25.2018.10.25.10.57.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 25 Oct 2018 10:57:26 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Tony Lindgren , Kalle Valo , Eyal Reizer , Anders Roxell , linux-wireless@vger.kernel.org Subject: [RFC][PATCH] wlcore: Fixup "Add support for optional wakeirq" Date: Thu, 25 Oct 2018 10:57:21 -0700 Message-Id: <1540490241-32021-1-git-send-email-john.stultz@linaro.org> 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 After commit 3c83dd577c7f ("wlcore: Add support for optional wakeirq") landed upstream, I started seeing the following oops on my HiKey board: [ 1.870279] Unable to handle kernel read from unreadable memory at virtual address 0000000000000010 [ 1.870283] Mem abort info: [ 1.870287] ESR = 0x96000005 [ 1.870292] Exception class = DABT (current EL), IL = 32 bits [ 1.870296] SET = 0, FnV = 0 [ 1.870299] EA = 0, S1PTW = 0 [ 1.870302] Data abort info: [ 1.870306] ISV = 0, ISS = 0x00000005 [ 1.870309] CM = 0, WnR = 0 [ 1.870312] [0000000000000010] user address but active_mm is swapper [ 1.870318] Internal error: Oops: 96000005 [#1] PREEMPT SMP [ 1.870327] CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted 4.19.0-05129-gb3d1e8e #48 [ 1.870331] Hardware name: HiKey Development Board (DT) [ 1.870350] Workqueue: events_freezable mmc_rescan [ 1.870358] pstate: 60400005 (nZCv daif +PAN -UAO) [ 1.870366] pc : wl1271_probe+0x210/0x350 [ 1.870371] lr : wl1271_probe+0x210/0x350 [ 1.870374] sp : ffffff80080739b0 [ 1.870377] x29: ffffff80080739b0 x28: 0000000000000000 [ 1.870384] x27: 0000000000000000 x26: 0000000000000000 [ 1.870391] x25: 0000000000000036 x24: ffffffc074ecb598 [ 1.870398] x23: ffffffc07ffdce78 x22: ffffffc0744ed808 [ 1.870404] x21: ffffffc074ecbb98 x20: ffffff8008ff9000 [ 1.870411] x19: ffffffc0744ed800 x18: ffffff8008ff9a48 [ 1.870418] x17: 0000000000000000 x16: 0000000000000000 [ 1.870425] x15: ffffffc074ecb503 x14: ffffffffffffffff [ 1.870431] x13: ffffffc074ecb502 x12: 0000000000000030 [ 1.870438] x11: 0101010101010101 x10: 0000000000000040 [ 1.870444] x9 : ffffffc075400248 x8 : ffffffc075400270 [ 1.870451] x7 : 0000000000000000 x6 : 0000000000000000 [ 1.870457] x5 : 0000000000000000 x4 : 0000000000000000 [ 1.870463] x3 : 0000000000000000 x2 : 0000000000000000 [ 1.870469] x1 : 0000000000000028 x0 : 0000000000000000 [ 1.870477] Process kworker/0:0 (pid: 5, stack limit = 0x(____ptrval____)) [ 1.870480] Call trace: [ 1.870485] wl1271_probe+0x210/0x350 [ 1.870491] sdio_bus_probe+0x100/0x128 [ 1.870500] really_probe+0x1a8/0x2b8 [ 1.870506] driver_probe_device+0x58/0x100 [ 1.870511] __device_attach_driver+0x94/0xd8 [ 1.870517] bus_for_each_drv+0x70/0xc8 [ 1.870522] __device_attach+0xe0/0x140 [ 1.870527] device_initial_probe+0x10/0x18 [ 1.870532] bus_probe_device+0x94/0xa0 [ 1.870537] device_add+0x374/0x5b8 [ 1.870542] sdio_add_func+0x60/0x88 [ 1.870546] mmc_attach_sdio+0x1b0/0x358 [ 1.870551] mmc_rescan+0x2cc/0x390 [ 1.870558] process_one_work+0x12c/0x320 [ 1.870563] worker_thread+0x48/0x458 [ 1.870569] kthread+0xf8/0x128 [ 1.870575] ret_from_fork+0x10/0x18 [ 1.870583] Code: 92400c21 b2760021 a90687a2 97e95bf9 (f9400803) [ 1.870587] ---[ end trace 1e15f81d3c139ca9 ]--- It seems since we don't have a wakeirq value in the dts, the wakeirq value in wl1271_probe() is zero, which then causes trouble in irqd_get_trigger_type(irq_get_irq_data(wakeirq)). This patch tries to address this by checking if wakeirq is zero, and not trying to add it to the resources if that is the case. Cc: Tony Lindgren Cc: Kalle Valo Cc: Eyal Reizer Cc: Anders Roxell Cc: linux-wireless@vger.kernel.org Acked-by: Tony Lindgren Signed-off-by: John Stultz --- drivers/net/wireless/ti/wlcore/sdio.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 4c2154b..bd10165 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -285,7 +285,7 @@ static int wl1271_probe(struct sdio_func *func, struct resource res[2]; mmc_pm_flag_t mmcflags; int ret = -ENOMEM; - int irq, wakeirq; + int irq, wakeirq, num_irqs; const char *chip_family; /* We are only able to handle the wlan function */ @@ -353,12 +353,17 @@ static int wl1271_probe(struct sdio_func *func, irqd_get_trigger_type(irq_get_irq_data(irq)); res[0].name = "irq"; - res[1].start = wakeirq; - res[1].flags = IORESOURCE_IRQ | - irqd_get_trigger_type(irq_get_irq_data(wakeirq)); - res[1].name = "wakeirq"; - ret = platform_device_add_resources(glue->core, res, ARRAY_SIZE(res)); + if (wakeirq > 0) { + res[1].start = wakeirq; + res[1].flags = IORESOURCE_IRQ | + irqd_get_trigger_type(irq_get_irq_data(wakeirq)); + res[1].name = "wakeirq"; + num_irqs = 2; + } else { + num_irqs = 1; + } + ret = platform_device_add_resources(glue->core, res, num_irqs); if (ret) { dev_err(glue->dev, "can't add resources\n"); goto out_dev_put; -- 2.7.4