From patchwork Tue Aug 23 13:43:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Haslam X-Patchwork-Id: 9295657 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 B4C09607F0 for ; Tue, 23 Aug 2016 13:43:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5EB02872B for ; Tue, 23 Aug 2016 13:43:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A905287E2; Tue, 23 Aug 2016 13:43:58 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 2D89A2872B for ; Tue, 23 Aug 2016 13:43:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753386AbcHWNnz (ORCPT ); Tue, 23 Aug 2016 09:43:55 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:37154 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753111AbcHWNny (ORCPT ); Tue, 23 Aug 2016 09:43:54 -0400 Received: by mail-wm0-f51.google.com with SMTP id i5so196503996wmg.0 for ; Tue, 23 Aug 2016 06:43:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=rbarpNWOz67DkZbhHzFWNEjNOVyiIUyoGy3mpNjuQ4E=; b=UBjbvHGy+fgKtzL1Ookx9un9oNZURsHxEGb5Mp/8FH67ZgK//Fnr944H6x90c6tCI3 2LXNUtlipcLOst5qZhnPA4b76SxCYV8+6JS7hs93fO5Q00GNFZ6BF6G+fSE3+IHnCsPP j0/x41p8DfPh6aIL5aAKKs4Ro9EFbcB3Z2FXU2UUo1z/TstuVX2K+OkgxOVjQUY9rXLV yLIEJffpyZanR4zgyfKezAqnnfATZnD6jlJOotZUmvyb2D7c/NQNgW1TQGK6D9B4Z2/Q 2ANUPQB+pO+DRIgqRW0ExCetbGcBicuoiaYle5DhNAqGvmSRx91Vuvcp9x2PiL7ckEpl rGFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=rbarpNWOz67DkZbhHzFWNEjNOVyiIUyoGy3mpNjuQ4E=; b=YXVxC5p+hAIV1oxCdmEkPnMj9a/+h22HVHKyXM3dCF6K635l7BbZc/6fCCXDWx9N3V 3XJGpcIV+ugEh8WyBkfXCTc4spIMucX4HhHuGuvTVTepzI+QV+9AX3k76LkP90dJyHMV njCu7vjGtbx3zEFW3AhqJlhm64BIaIH/nXBfHqmLZlFCnH+beYF5cgDOTcyKt5KtQUyz qYlp0/W/hrpiwp8ZV2TtAKEkWghYcRaZm3o9lDbcnkKWS+D2HGFiEmBnIpmg2xM+k25H 7GsSyVSYi4lCr29JjdSCn6TH9ifkb3xgqu/i2rv19FHfFdBrXXwNM9KTqzd02C8/CTAN JI5g== X-Gm-Message-State: AEkoouuTgbYkuv0secjUL3aE009kyETg/LhV3ijZM9NIsfP6wSvCyjthvO23X1a/LgRzdVOX X-Received: by 10.28.40.133 with SMTP id o127mr20816253wmo.46.1471959833002; Tue, 23 Aug 2016 06:43:53 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id i1sm3937362wjl.9.2016.08.23.06.43.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Aug 2016 06:43:52 -0700 (PDT) From: ahaslam@baylibre.com To: rjw@rjwysocki.net, linux-pm@vger.kernel.org Cc: Axel Haslam Subject: [PATCH 1/2] PM / QoS: Fix check for invalid request Date: Tue, 23 Aug 2016 15:43:46 +0200 Message-Id: <1471959827-19837-1-git-send-email-ahaslam@baylibre.com> X-Mailer: git-send-email 2.7.1 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 From: Axel Haslam The check for a invalid request is using the "type" member of the request pointer which is not yet set when this function is called at the start of __dev_pm_qos_add_request. Fix this by passing a type directly, and not the request pointer. Signed-off-by: Axel Haslam --- drivers/base/power/qos.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c index 7f3646e..0bd03e6 100644 --- a/drivers/base/power/qos.c +++ b/drivers/base/power/qos.c @@ -291,9 +291,9 @@ void dev_pm_qos_constraints_destroy(struct device *dev) } static bool dev_pm_qos_invalid_request(struct device *dev, - struct dev_pm_qos_request *req) + enum dev_pm_qos_req_type type) { - return !req || (req->type == DEV_PM_QOS_LATENCY_TOLERANCE + return (type == DEV_PM_QOS_LATENCY_TOLERANCE && !dev->power.set_latency_tolerance); } @@ -303,7 +303,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_request(dev, type)) return -EINVAL; if (WARN(dev_pm_qos_request_active(req),