Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp2084203ybb; Fri, 29 Mar 2019 18:38:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGqt7b8p7I+DXF3xP9UOq1aCdtWXf9VJHV4VKV0AvuUQA4E4NzXyhI2zdrVPSkyp4qZxv+ X-Received: by 2002:a65:6150:: with SMTP id o16mr18799293pgv.285.1553909933265; Fri, 29 Mar 2019 18:38:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553909933; cv=none; d=google.com; s=arc-20160816; b=mDMPSH0pEwmqw0zYTPSlr/bAXS0PTQIqtdSb4wzGsZCznblFrHZkcx6u1zgK1+YEUL zEfWkK5Pa9bwm1GLGzJxGvuzVM49DHVTxDkmK2K12PZJ1BYFobnoG6/1xwUswDKcwzK3 pO7RxPFi+gg3pgTEK3pFbq9RZBXp0+5IXeI8XsQq6ltJ/FqrHpJKORu3MTxfkQf1n9oU rHw5cEoBvTcW0zOvNE9mFxgVyW+mVGQjOGodqnTIC9ukgSpAdkBOXFKWrdi8iuitdxyz ZHsVT+Gt/38lApvmrUBTb3nLHRAGgd3PShKdDqaIHhGpeYbxh4k6glFXI8N6Wxnx9bBk GoVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=eHaBcT+6/rGVnMPPB5HGPpBgfw+QiG7aV/C8DRkHiJE=; b=rRE0eJ6YqX8GA4wIH0EfL7WozQralXgMf407K5ASghHnR72zuTljSkEBq/2/WWAy5c wFEOBJc/S1I1zGOQfCiEf7Y1gqKJSYECjJXeP+ctYM1Q9MWBy6Ig5PSDKEWWiNvwiGT7 liuxfUou6IucT3SuXF0w6Zpf7k3vEguQbGNU9zvoiRaPE/GxAGPUru41EJd9Njtnk9Ya rwAn6NGmo42xyRV9RIEUdbM0/cXSapbXH6E5VhK2HmKyZQ3af594AX1qJYd5tt0izZjV xuvN6wGzWNb5mCVyKS1Tya7J0HZM/40diejRVVdj06teBy5XJLfZq8cc1xlJ9s5MQ/Mi 9Qbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XSFAgra3; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n31si3221444pgm.10.2019.03.29.18.38.38; Fri, 29 Mar 2019 18:38:53 -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=@kernel.org header.s=default header.b=XSFAgra3; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731560AbfC3BaZ (ORCPT + 99 others); Fri, 29 Mar 2019 21:30:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:37590 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731481AbfC3BaW (ORCPT ); Fri, 29 Mar 2019 21:30:22 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7F3E321773; Sat, 30 Mar 2019 01:30:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553909422; bh=RCUOOEFSPoIPTcT0oo4nFg3T6VQxpYUL7Yvs6SY36mU=; h=From:To:Cc:Subject:Date:From; b=XSFAgra34igHZEurbANja3w7v1yVe0ZPxlGX4siYoVK6m42fM+JXDbUMgbEgh995v CbETXCT0mN7jtjK78iiCt7vZxaPGriotGfXyVVdmqXwLMOfgivKRTU/w7mAvtqZw5w izMgsMLS9R8oVFKNwY+cF7mCpM1gzXl2kYi/DDCM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Robert Jarzmik , Linus Walleij , Sasha Levin , linux-gpio@vger.kernel.org Subject: [PATCH AUTOSEL 4.14 01/37] gpio: pxa: handle corner case of unprobed device Date: Fri, 29 Mar 2019 21:29:44 -0400 Message-Id: <20190330013020.379-1-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Robert Jarzmik [ Upstream commit 9ce3ebe973bf4073426f35f282c6b955ed802765 ] In the corner case where the gpio driver probe fails, for whatever reason, the suspend and resume handlers will still be called as they have to be registered as syscore operations. This applies as well when no probe was called while the driver has been built in the kernel. Nicolas tracked this in : https://bugzilla.kernel.org/show_bug.cgi?id=200905 Therefore, add a failsafe in these function, and test if a proper probe succeeded and the driver is functional. Signed-off-by: Robert Jarzmik Reported-by: Nicolas Chauvet Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/gpio/gpio-pxa.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c index 2943dfc4c470..822ad220f0af 100644 --- a/drivers/gpio/gpio-pxa.c +++ b/drivers/gpio/gpio-pxa.c @@ -776,6 +776,9 @@ static int pxa_gpio_suspend(void) struct pxa_gpio_bank *c; int gpio; + if (!pchip) + return 0; + for_each_gpio_bank(gpio, c, pchip) { c->saved_gplr = readl_relaxed(c->regbase + GPLR_OFFSET); c->saved_gpdr = readl_relaxed(c->regbase + GPDR_OFFSET); @@ -794,6 +797,9 @@ static void pxa_gpio_resume(void) struct pxa_gpio_bank *c; int gpio; + if (!pchip) + return; + for_each_gpio_bank(gpio, c, pchip) { /* restore level with set/clear */ writel_relaxed(c->saved_gplr, c->regbase + GPSR_OFFSET); -- 2.19.1