From patchwork Tue Dec 16 23:09:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 5504191 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EDCBF9F1CD for ; Tue, 16 Dec 2014 23:11:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 22FA020A16 for ; Tue, 16 Dec 2014 23:11:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 48FFF20A14 for ; Tue, 16 Dec 2014 23:11:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752108AbaLPXLX (ORCPT ); Tue, 16 Dec 2014 18:11:23 -0500 Received: from mail-ig0-f170.google.com ([209.85.213.170]:53532 "EHLO mail-ig0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751527AbaLPXJy (ORCPT ); Tue, 16 Dec 2014 18:09:54 -0500 Received: by mail-ig0-f170.google.com with SMTP id r2so8581770igi.3 for ; Tue, 16 Dec 2014 15:09:53 -0800 (PST) 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:in-reply-to :references; bh=HT/dB9dUowtQQIatw7LH2/CcAkljyR2iki9FUKnXK/w=; b=CYAO8CYyMxom+V5fh8Oa/84bWn8upwTtdQ5gsHJagOGvc+pE/VpsXCFxUM1bOChRzS JLnI0jMK+wpTsA71/Ibe4/3UczwdqQSUpg8ZHU6D9mAkIRupnkJMN97iAyz/Cze7a0Wl 4dj9a817W8CTVowObSIxo2a1RP/wdwo4Wuavvbuxz7k3Ht7M6l8zAfnawJJYwXMXBXYI U01BQbmLX8Aj8Znu9r7A49aWmXox4Dyplqll/Je1tKgM5pibgQlXdbIzsUC+aDmurxOy lRenH1MI4xypEWIg+x4cnOvh3ET9ykUdT3AZmnmjs1jt1KE5dI8BKYk2tywZNvLpuQn+ Kj3g== X-Gm-Message-State: ALoCoQmiVpkGn8j7nWYOXGEyVS8myafMaW6VbHiHyLIZ9Wws7Sfi9P2mbbSOHjjDyE6OjZaoaeEd X-Received: by 10.42.103.7 with SMTP id k7mr34328103ico.33.1418771393842; Tue, 16 Dec 2014 15:09:53 -0800 (PST) Received: from dtor-ws.mtv.corp.google.com ([172.22.64.149]) by mx.google.com with ESMTPSA id s10sm1424817igr.2.2014.12.16.15.09.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Dec 2014 15:09:53 -0800 (PST) From: Dmitry Torokhov To: "Rafael J. Wysocki" , Viresh Kumar Cc: Thomas Petazzoni , Geert Uytterhoeven , Stefan Wahren , Paul Gortmaker , Nishanth Menon , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] PM / OPP: fix warning in of_free_opp_table Date: Tue, 16 Dec 2014 15:09:37 -0800 Message-Id: <1418771379-24369-3-git-send-email-dtor@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c In-Reply-To: <1418771379-24369-1-git-send-email-dtor@chromium.org> References: <1418771379-24369-1-git-send-email-dtor@chromium.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Not having OPP defined for a device is not a crime, we should not splat warning in this case. Also, it seems that we are ready to accept invalid dev (find_device_opp will return ERR_PTR(-EINVAL) then) so let's not crash in dev_name() in such case. Signed-off-by: Dmitry Torokhov Acked-by: Viresh Kumar Acked-by: Nishanth Menon --- drivers/base/power/opp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index b78c14d..413c7fe 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -799,9 +799,15 @@ void of_free_opp_table(struct device *dev) /* Check for existing list for 'dev' */ dev_opp = find_device_opp(dev); - if (WARN(IS_ERR(dev_opp), "%s: dev_opp: %ld\n", dev_name(dev), - PTR_ERR(dev_opp))) + if (IS_ERR(dev_opp)) { + int error = PTR_ERR(dev_opp); + if (error != -ENODEV) + WARN(1, "%s: dev_opp: %ld\n", + IS_ERR_OR_NULL(dev) ? + "Invalid device" : dev_name(dev), + error); return; + } /* Hold our list modification lock here */ mutex_lock(&dev_opp_list_lock);