From patchwork Tue Sep 5 21:14:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Jan_H=2E_Sch=C3=B6nherr?= X-Patchwork-Id: 9939615 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 82180604D3 for ; Tue, 5 Sep 2017 21:15:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F13328A07 for ; Tue, 5 Sep 2017 21:15:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60D8E28A14; Tue, 5 Sep 2017 21:15:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C107628A07 for ; Tue, 5 Sep 2017 21:15:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752423AbdIEVPH (ORCPT ); Tue, 5 Sep 2017 17:15:07 -0400 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:61794 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752303AbdIEVPH (ORCPT ); Tue, 5 Sep 2017 17:15:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1504646106; x=1536182106; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=TFeMJ9wBGemJdOB7HUYybHHbD3yRAYLwJWFUlXvjS/E=; b=wG76EYGYMK5Li1iUln8cjOSMohjkC0x65pSojVgm+bTWoh9vV77DvoLO WWS05/uWRlwZyOGnk0z+Ljgz00DNjuI9WetwAT+FQNiG+vJly0TMwau9S Ex5g4rrV2Dzgkvny5Su5L4sdOLX0mEoYWvi3abTHrBg1KLJJyKUdoJ6DQ 4=; X-IronPort-AV: E=Sophos;i="5.41,481,1498521600"; d="scan'208";a="690839499" Received: from sea3-co-svc-lb6-vlan2.sea.amazon.com (HELO email-inbound-relay-2c-168cbb73.us-west-2.amazon.com) ([10.47.22.34]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 05 Sep 2017 21:15:03 +0000 Received: from u28d244cd5724546b2f74.ant.amazon.com (pdx2-ws-svc-lb17-vlan3.amazon.com [10.247.140.70]) by email-inbound-relay-2c-168cbb73.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id v85LEvtu123036 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 5 Sep 2017 21:14:59 GMT Received: from u28d244cd5724546b2f74.ant.amazon.com (localhost [127.0.0.1]) by u28d244cd5724546b2f74.ant.amazon.com (8.14.4/8.14.4/Debian-2ubuntu2.1) with ESMTP id v85LEsGY004315; Tue, 5 Sep 2017 23:14:55 +0200 Received: (from jschoenh@localhost) by u28d244cd5724546b2f74.ant.amazon.com (8.14.4/8.14.4/Submit) id v85LErmh004307; Tue, 5 Sep 2017 23:14:53 +0200 From: =?UTF-8?q?Jan=20H=2E=20Sch=C3=B6nherr?= To: "Rafael J. Wysocki" Cc: linux-pm@vger.kernel.org, =?UTF-8?q?Jan=20H=2E=20Sch=C3=B6nherr?= Subject: [PATCH] PM / QoS: Use the correct variable to check the QoS request type Date: Tue, 5 Sep 2017 23:14:29 +0200 Message-Id: <1504646069-4216-1-git-send-email-jschoenh@amazon.de> X-Mailer: git-send-email 2.3.1.dirty MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use the actual function argument for the validation of the request type, instead of the type field in a fresh (supposedly zero-initialized) request structure. Signed-off-by: Jan H. Schönherr --- drivers/base/power/qos.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c index f850dae..277d43a 100644 --- a/drivers/base/power/qos.c +++ b/drivers/base/power/qos.c @@ -277,11 +277,11 @@ void dev_pm_qos_constraints_destroy(struct device *dev) mutex_unlock(&dev_pm_qos_sysfs_mtx); } -static bool dev_pm_qos_invalid_request(struct device *dev, - struct dev_pm_qos_request *req) +static bool dev_pm_qos_invalid_req_type(struct device *dev, + enum dev_pm_qos_req_type type) { - return !req || (req->type == DEV_PM_QOS_LATENCY_TOLERANCE - && !dev->power.set_latency_tolerance); + return type == DEV_PM_QOS_LATENCY_TOLERANCE && + !dev->power.set_latency_tolerance; } static int __dev_pm_qos_add_request(struct device *dev, @@ -290,7 +290,7 @@ static int __dev_pm_qos_add_request(struct device *dev, { int ret = 0; - if (!dev || dev_pm_qos_invalid_request(dev, req)) + if (!dev || !req || dev_pm_qos_invalid_req_type(dev, type)) return -EINVAL; if (WARN(dev_pm_qos_request_active(req),