Message ID | 1524732790-2234-2-git-send-email-ulf.hansson@linaro.org |
---|---|
State | New |
Headers | show
Delivered-To: patches@linaro.org Received: by 10.46.151.6 with SMTP id r6csp1973272lji; Thu, 26 Apr 2018 01:53:17 -0700 (PDT) X-Received: by 2002:a19:9f10:: with SMTP id i16-v6mr15955769lfe.29.1524732797616; Thu, 26 Apr 2018 01:53:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524732797; cv=none; d=google.com; s=arc-20160816; b=n5XuARQdn54I8W59UzStHbp8qOempI2pQYxOkEQsvPZQZpHAFGt/NWIaQWHw5hkoub 5vx2cEZN7N5YzdwpDGWYX3PtoQb8w8rs44PLAHALJ/HI+VEsUq7YxO3a3dqaxP3Iqdiw ookgCqvr3i9rTLImm0eLZWWj+SIsKuDDAj4msIHoYeqGNQjrxpg2SoEOAcur3ofr9TPw m2mEjrc/Cw5Xt/IrcALkVIJYTXNQRA1pAk2+zj1jy/ZOV5Ay5Z5b6pdg9Cr9hpLaiPnT pe0SGgCYTX5ZMA1Xc62fdIgrD9N/CHCv5b0gi0VlYyoSMzaIhfErV90FJvd1o0i/znTF EmXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=erb1SyGANxVl6gHWShUQ9kqj4ktELneZ9u3fj92lBqQ=; b=lBiLcZB4PepkxYDfTiedhfD/YlPE/O4JobKGeCt6VipfeWMtNZpyFK7ZL+/tNw+doU 9Jv+hn/XF/uwEczNt0jcFtIQ0Gqzg0pELKiDpDWgk5KHa1i3KbWgPRLIDB/Zw/HoAsuS B8EqcNEUYG3ril4NpPFR0aOsQ+vbqEmzhTx4eaQjptdsB3svb2iqvGrDROiQst+Anofq um+vy45VKU9sFRXRV7qL1r0Fblvrls92i8lU3LEAWtgtrCYNGThl3m6feRfQlQuROsjh DTWxa1j7Lh3g5YcESFeghBofQCj12qzXmyvz0KJoItjgE7Vc4lMdS4JKKFD1fA/eJQxv HhHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cz1EUeiH; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: <ulf.hansson@linaro.org> Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id y129-v6sor3381698lfc.39.2018.04.26.01.53.17 for <patches@linaro.org> (Google Transport Security); Thu, 26 Apr 2018 01:53:17 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@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=cz1EUeiH; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@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:cc:subject:date:message-id:in-reply-to:references; bh=erb1SyGANxVl6gHWShUQ9kqj4ktELneZ9u3fj92lBqQ=; b=cz1EUeiHl4NbC4RH9BK8Rr4UfAAbIWjpkVSp9BHZa3En8vWutSIOU06QmHyIWWX3X5 rMnT+nU2ht6VOTONGDxf7AMf55c7bEcRBefUZ4w6vYYEJC21R9eadYF4tTpy9LgqlpmO Wwkl5PFXleIpRHfBrS2RGX++kUkPmNQVulyNc= 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:in-reply-to :references; bh=erb1SyGANxVl6gHWShUQ9kqj4ktELneZ9u3fj92lBqQ=; b=CyNIxD+lAA48R9jWX9iePwXweiQKfjbMsRgx9b7PthD9rh7O5dS/G0QieQZTg7m8mU FRXHHYEiDr1AX2YIjP/Xl4h2fo69Uyf5KOF93Zs0CE+eM1wMCs7GuAXzgiusCXmrNpd3 ERbMV7AwTxX1afGeTlyaZ0JomYw/3ZK6RuBJX3Q98WL1TIhXwet0I3c5kf7CNq9yP5Mc YXYv/RH9H81g732y0ajTPzAWnSxEFFkSz8gqfgTyvIJ0a5CqbYbLm5ksSGfprWw7ATCx 2o2nCTkoftRlyeKb0n7FPM3IkWdzDL2mK4gLv56C1PQSQ0YHI/C80x4UjJ7um25ocrmr cMVA== X-Gm-Message-State: ALQs6tCD7mgt2bdjCMS+nnZ8+F8eNt/xyhbdJLt6VonFBFcWtLgZoFvy jMCKZGus6cBgTRNDTvLCEbrr1jeN X-Google-Smtp-Source: AB8JxZqanroxBvuAAJhH4Qr5NuNHaCTuHoLRrKMou4quakAWpZv+8j2I/o5BAAS2MwMo/bEUcvrsag== X-Received: by 2002:a19:fc04:: with SMTP id a4-v6mr16815435lfi.136.1524732797391; Thu, 26 Apr 2018 01:53:17 -0700 (PDT) Return-Path: <ulf.hansson@linaro.org> Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id u83-v6sm681097lff.65.2018.04.26.01.53.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 Apr 2018 01:53:16 -0700 (PDT) From: Ulf Hansson <ulf.hansson@linaro.org> To: "Rafael J . Wysocki" <rjw@rjwysocki.net>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, linux-pm@vger.kernel.org Cc: Ulf Hansson <ulf.hansson@linaro.org>, Kevin Hilman <khilman@kernel.org>, Geert Uytterhoeven <geert+renesas@glider.be>, Viresh Kumar <viresh.kumar@linaro.org>, Vincent Guittot <vincent.guittot@linaro.org>, Mark Brown <broonie@kernel.org>, Vinod Koul <vinod.koul@intel.com>, Sanyog Kale <sanyog.r.kale@intel.com>, Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>, Wolfram Sang <wsa@the-dreams.de>, Russell King <linux@armlinux.org.uk>, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, "# v4 . 11+" <stable@vger.kernel.org> Subject: [PATCH 01/11] PM / Domains: Fix error path during attach in genpd Date: Thu, 26 Apr 2018 10:53:00 +0200 Message-Id: <1524732790-2234-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1524732790-2234-1-git-send-email-ulf.hansson@linaro.org> References: <1524732790-2234-1-git-send-email-ulf.hansson@linaro.org> |
Series |
PM / Domains: Fixup error paths with dev_pm_domain_attach()
|
expand
|
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 1ea0e25..ef6cf3d5 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2246,6 +2246,9 @@ int genpd_dev_pm_attach(struct device *dev) genpd_lock(pd); ret = genpd_power_on(pd, 0); genpd_unlock(pd); + + if (ret) + genpd_remove_device(pd, dev); out: return ret ? -EPROBE_DEFER : 0; }
In case the PM domain fails to be powered on in genpd_dev_pm_attach(), it returns -EPROBE_DEFER, but keeping the device attached to its PM domain. This leads to problems when the next attempt to attach is re-tried. More precisely, in that situation an -EEXIST error code is returned, because the device already has its PM domain pointer assigned, from the first attempt. Now, because of the sloppy error handling by the existing callers of dev_pm_domain_attach(), probing is allowed to continue when -EEXIST is returned. However, in such case there are no guarantees that the PM domain is powered on by genpd, which may lead to hangs when buses/drivers tried to access their devices. Let's fix this behaviour, simply by detaching the device when powering on fails in genpd_dev_pm_attach(). Cc: <stable@vger.kernel.org> # v4.11+ Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> --- drivers/base/power/domain.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.7.4