Received: by 10.192.165.156 with SMTP id m28csp1834116imm; Thu, 12 Apr 2018 04:27:03 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+qBMMO/h9K+mMkCEIdqDNeSkAFLF616AOEvQR+7zyi5C3aNQu1WC3tQ9um+RkbNslVjHRe X-Received: by 10.98.133.28 with SMTP id u28mr7350343pfd.190.1523532423121; Thu, 12 Apr 2018 04:27:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523532423; cv=none; d=google.com; s=arc-20160816; b=HspBwj5ofmWAhn9zU/OrwM4CqibonrBlJ9Pcgtj7iaVTFQqpcsRZ6IB9+16l0pmjye I5Gp94mZ3v7bjw28e7mPd55a6DZGewyvIc9f3a3jGVLqVUPeGMSLuy3h9BUAqpCTLFNc +M9xekfIerLVajvu1YuaZi9vvfYuVnaWRDZn9kbRXrAjw1Nd4Eigp2IiSxKEHWnqIOKR GwEzjIdbquYI20hvdXpQFIh3GA6omdK50QyVQuCHxJNpCLnx8GyPR4tFbt453bkD0Sa9 D12y44WNI100gJLm7X9LrogTBoDKqF07VPPhbvEqxJWt+ZWn4Do5if6rT5eoUMpZsEE2 bxAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=XHPVBb922TA1uGb222Hxlm4AdEoDZBjgQ2Eka3bpJ8w=; b=YBaJ/jbU7Vzy4Qi/IaqZ9QhAUVZeDkra0LHmWbCmKqjnPQh+agjlou01vjuRPcED3b eyY42HTkPeS0vK/Un7Lhro6m0iVffPIeu5Q1ogD0pOcs19x+GrASMZ7B9GzhOpQo3qmv 2gBAyI1X9+5/GNZKSm6SYqTFcaJA7GFMfwpBViNxYXNCvjUxLn/3efSVkQkPN1yTR+tp lnWP5rhDDBSCQEdT4ZnnftLGUJJQwRDbBUSxpKXT5h5qFUif8qmL9SeYCaXctjpuIfIV CyScaDUWXYdwL6w4oyOh6B35rpX20VLArczinIfj9VUfoCFED3w6BSnlIdaGUJ4jEfej hjAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fS8hsvGo; 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 m24si2067703pgv.596.2018.04.12.04.26.25; Thu, 12 Apr 2018 04:27:03 -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=fS8hsvGo; 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 S1753461AbeDLLVJ (ORCPT + 99 others); Thu, 12 Apr 2018 07:21:09 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:43317 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752652AbeDLLOl (ORCPT ); Thu, 12 Apr 2018 07:14:41 -0400 Received: by mail-lf0-f65.google.com with SMTP id v207-v6so7112409lfa.10 for ; Thu, 12 Apr 2018 04:14:40 -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:in-reply-to:references; bh=XHPVBb922TA1uGb222Hxlm4AdEoDZBjgQ2Eka3bpJ8w=; b=fS8hsvGop8Bsgb6yQEOWHBdFib6VPln3gzYgN0qi9klYlzUTxc0Bbs0J2+cmm43CIY lbTICJOy5TaFMxBjyEu8DN3ba7i6KdcIkbVNkTLqtBTcONL9qXjeBlDtIB4tAUdzMgao mwZmOdktzkihRJOL6g+dD75DxivvmSIMzfgYo= 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=XHPVBb922TA1uGb222Hxlm4AdEoDZBjgQ2Eka3bpJ8w=; b=KIZ8da0wfqbSHlfXKbTXDfVfBBQimuSUwtKIqCPBm96VufWEJEglZ38xy4iqXNODyd Jy8SY7JCL1hvncqYmpbMapbqoZvJTbZnzwWyd/knnfwD8EIDIxmmwU3cDJxHpz+762bZ ls6h5YBjhTKW+Zh20tJPfbQd0mHoNDsk/tC0AqbdwaziiXDEW/VLqRibbg8GAOnaTps/ IU8SdKj6mF4SBbwMCs+fkwMWRDlSS7hsdqRhN0XNWGmORGmsisFUXUV70L01WwC/4qG3 kWY11aEv6lcOzqnzREwPwuZCdnl8XVLhAYZycJ1CtHz4Kg5/3KQN9OPqFqydYNQpUanT v1bQ== X-Gm-Message-State: ALQs6tBbS1eKFeRqcZm2De3k0dqjeeuAqDlcNadkm0WkfDT1LTEvOP0e WSCCRID1IGB1LRKPiUqlYYY0ZA== X-Received: by 10.46.144.72 with SMTP id n8mr411094ljg.96.1523531679941; Thu, 12 Apr 2018 04:14:39 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id r29sm543187lje.72.2018.04.12.04.14.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Apr 2018 04:14:39 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , linux-pm@vger.kernel.org Cc: Kevin Hilman , Lina Iyer , Lina Iyer , Ulf Hansson , Rob Herring , Daniel Lezcano , Thomas Gleixner , Vincent Guittot , Stephen Boyd , Juri Lelli , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 01/26] PM / Domains: Don't treat zero found compatible idle states as an error Date: Thu, 12 Apr 2018 13:14:06 +0200 Message-Id: <1523531671-27491-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523531671-27491-1-git-send-email-ulf.hansson@linaro.org> References: <1523531671-27491-1-git-send-email-ulf.hansson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of returning -EINVAL from of_genpd_parse_idle_states() in case none compatible states was found, let's return 0 to indicate success. Assign also the out-parameter *states to NULL and *n to 0, to indicate to the caller that zero states have been found/allocated. This enables the caller of of_genpd_parse_idle_states() to easier act on the returned error code. Cc: Lina Iyer Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 1ea0e25..c2ef944 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2331,8 +2331,8 @@ static int genpd_iterate_idle_states(struct device_node *dn, * * Returns the device states parsed from the OF node. The memory for the states * is allocated by this function and is the responsibility of the caller to - * free the memory after use. If no domain idle states is found it returns - * -EINVAL and in case of errors, a negative error code. + * free the memory after use. If any or zero compatible domain idle states is + * found it returns 0 and in case of errors, a negative error code is returned. */ int of_genpd_parse_idle_states(struct device_node *dn, struct genpd_power_state **states, int *n) @@ -2341,8 +2341,14 @@ int of_genpd_parse_idle_states(struct device_node *dn, int ret; ret = genpd_iterate_idle_states(dn, NULL); - if (ret <= 0) - return ret < 0 ? ret : -EINVAL; + if (ret < 0) + return ret; + + if (!ret) { + *states = NULL; + *n = 0; + return 0; + } st = kcalloc(ret, sizeof(*st), GFP_KERNEL); if (!st) -- 2.7.4