Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp886249yba; Thu, 18 Apr 2019 11:12:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqxC9eBILnqIr2sfrMNqot4gxnRNNJD7JHoIhHgXVn+ds9zyWIlwC9Itjt62lMgMP6hk0sDb X-Received: by 2002:a17:902:b717:: with SMTP id d23mr93957701pls.260.1555611144914; Thu, 18 Apr 2019 11:12:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555611144; cv=none; d=google.com; s=arc-20160816; b=VJplAdaUa7Jcg7dcKQunJyB4GFEU6ixV56DG7eoB6zEv9qqBXedFFdYVUf3AN86NTd aR1Opln+a2QVae5nBxbFMK9vGSeS/eoD+WeW4r3eHq0qtxptm/dHjHbarO6j5GkBzEvj V5phAPb/vRhzg3gl2ZUP3nqCxMYjJtIALDPAK4Nxnk3F0cv0GnaAQ5JKCQ5MHG+sX+I3 yEm/TMXanNUTMntYQ4QqMNv6XyovQp7WoY1d9C+e7/q5XKXe3JPPA5jm0ezp6MkwBhIl 1PHG8vtMXgw5ORVy2iPWtX3x+sJLdBX4rGGlM7fyFN45saLbI+zPFKxanV8pkTyhVtrv gcrQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FWEboU8f4AqPtiGzBtFQWTbksqqEIKA46YgrSYdJT3k=; b=w+d34H73ZtnJ3GVU6ljxb0WxNGL5jdsFwIjPOpnKCKmrTzJJHNUXCn+Nj4AbI9iJyI CP/WKmTeVKtCed1rYJN+HcRjqyge4uDsAsnu01/t8D7k8xVpQkR6etfVkNP3nh6GgHkK becmD4eh+uZkwZea/5WltiWTabefnNYM4M8Ozj6ffYxBgMMa4VgwUAcdwZk3LE8/6KYu PE5RSPi82BRKNIn0AOxnqojPJ9yQ/FBsVhPPaLjEXelpqXBeztADXHlbR5N+sguIPRqc Qzm1zbs84u5H1WfdBm7eXnTA8YQs1agfNTiAtc/3utTc7oX4Z0qXz1W2npeQYBurTAAx KeHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Y+FvfvJ8; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m3si2417035pgg.478.2019.04.18.11.12.10; Thu, 18 Apr 2019 11:12:24 -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=Y+FvfvJ8; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391870AbfDRSJS (ORCPT + 99 others); Thu, 18 Apr 2019 14:09:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:40834 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391573AbfDRSJR (ORCPT ); Thu, 18 Apr 2019 14:09:17 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EEB0820652; Thu, 18 Apr 2019 18:09:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555610956; bh=yoddK5QqcQmZGItL79TOqBxBAOmkqU6Un+jyd8hak3A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y+FvfvJ8lFf003xKpyp3P2ibPiFDNozhrLxdN4ChLykg2YCCKbTpFwdT03EahZL3d KQJMjjpxkUb0me/fkyTX2hLO3li7aEc5iS1U9axCcVft59Ou60y6hMUmDap1Vlj+NB /jWYviKduPuQ9K3SoqW3qK2B+J9UPgSvuvzes9NI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Jarzmik , Nicolas Chauvet , Linus Walleij , Sasha Levin Subject: [PATCH 4.9 28/50] gpio: pxa: handle corner case of unprobed device Date: Thu, 18 Apr 2019 19:57:39 +0200 Message-Id: <20190418160426.247037254@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160422.455656724@linuxfoundation.org> References: <20190418160422.455656724@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ 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 7a6305884f97..32d22bdf7164 100644 --- a/drivers/gpio/gpio-pxa.c +++ b/drivers/gpio/gpio-pxa.c @@ -774,6 +774,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); @@ -792,6 +795,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