From patchwork Tue Oct 29 23:14:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 3112441 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@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 8B7C29F3E2 for ; Tue, 29 Oct 2013 23:14:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C53AC20203 for ; Tue, 29 Oct 2013 23:14:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 00F5A20204 for ; Tue, 29 Oct 2013 23:14:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752059Ab3J2XOk (ORCPT ); Tue, 29 Oct 2013 19:14:40 -0400 Received: from mail-ie0-f173.google.com ([209.85.223.173]:41074 "EHLO mail-ie0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751830Ab3J2XOj (ORCPT ); Tue, 29 Oct 2013 19:14:39 -0400 Received: by mail-ie0-f173.google.com with SMTP id u16so969213iet.4 for ; Tue, 29 Oct 2013 16:14:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:to:from:cc:date:message-id:user-agent:mime-version :content-type:content-transfer-encoding; bh=T62OkJSHOSiqMCbjyGw5si6E5Z9SIZN7lkunNxNyPdU=; b=bdKfwarliPm/fdJYKKu5XRM9TT3zSi4iadaMmPh56mq68kJzaEIffGys+5OpGTADHn G3j0oi0p/e8kIIJJWjxIgPycwK5tlPOljw2t4zfmIfnjma9GCkuMTHodh0NF1zRKbnfp 3yDlEUOd+xOCn+bBvUnZrzrmZvHQjO06J4SYPeQzojnIbCMNN7aYb9/Ff28QaCC7UXCm latCwypQdEGqRKMhlMHIsesi8W20lHmeFczcTxPe2FMVmP3hSms95q/b5Ju2KKOgR9D5 fqQIK0p+BmtL3s+7Ncg5gnSsKYzPtAIoKDbnTmFMZ3Q3ndWvM5t2kcHncdC2Zalv3kkq enhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:from:cc:date:message-id:user-agent :mime-version:content-type:content-transfer-encoding; bh=T62OkJSHOSiqMCbjyGw5si6E5Z9SIZN7lkunNxNyPdU=; b=ZZrhFsOSAp37vEiKGIaDRSUAGZQM9ZIYIzHRT84JOG74RtcKck7QW8tIg+aqQXRg0q 9qAl8AJtKcoEzGuexw0FM1i2sJjs5aSMHrsvMXyKU0oKO1rczIIW4h3kKjt4PNSs0s82 5R+ULYj580tNdk32wh/za1pFVn06Pc5RorplodL5XKjII5ouZRhLNcLUsOD/BOw7bdq2 kF7ricA+anYoWzdkFDlBjrQtBqVWXZKGhJztmCM8kt1nh4Q867P0QPh9NEO/bHkhtJ92 id4kOzVcgpHnWraPxDOZ7Sb3jHDida9QGkmIWfIpt0c12nlhwT8Dc+rG33yBuodkVglW Wvbg== X-Gm-Message-State: ALoCoQkW9jcBguqfPTwbGIb0kn7Z/k1bRpYtYbGUKgGM973ill2a1Xu27W+MsOJX6VRjXauElDFI2RrP/VpNltkf78foZ04WLGXqRn5Ex2U72dkq4dbW/y0MyFEW62P44Yr7yUAXhtX1RKJLSD964iWK8CoAjqJkazNjr3b3t3fIdXZ9xwUofwZI55o1pndioC7stR+c+zV9XZEJpplCyT4ca849XHCOz9VpK1Vumo3Hin8IHt5Yg1o= X-Received: by 10.42.190.142 with SMTP id di14mr1303283icb.45.1383088479143; Tue, 29 Oct 2013 16:14:39 -0700 (PDT) Received: from localhost ([172.16.49.32]) by mx.google.com with ESMTPSA id yt10sm4201952igb.9.2013.10.29.16.14.38 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 29 Oct 2013 16:14:38 -0700 (PDT) Subject: [PATCH] PCI: Report pci_pme_active() kmalloc failure To: linux-pci@vger.kernel.org From: Bjorn Helgaas Cc: Matthew Garrett , "Rafael J. Wysocki" Date: Tue, 29 Oct 2013 17:14:38 -0600 Message-ID: <20131029231437.19711.61623.stgit@bhelgaas-glaptop.roam.corp.google.com> User-Agent: StGit/0.16 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Previously, if kmalloc() failed, we claimed "PME# enabled" in dmesg, even though we didn't add the device to the pci_pme_list. This prints a more correct warning. Signed-off-by: Bjorn Helgaas Acked-by: Rafael J. Wysocki --- drivers/pci/pci.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index ad7fc72..36cc8d5 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1638,8 +1638,10 @@ void pci_pme_active(struct pci_dev *dev, bool enable) if (enable) { pme_dev = kmalloc(sizeof(struct pci_pme_device), GFP_KERNEL); - if (!pme_dev) - goto out; + if (!pme_dev) { + dev_warn(&dev->dev, "can't enable PME#\n"); + return; + } pme_dev->dev = dev; mutex_lock(&pci_pme_list_mutex); list_add(&pme_dev->list, &pci_pme_list); @@ -1660,7 +1662,6 @@ void pci_pme_active(struct pci_dev *dev, bool enable) } } -out: dev_dbg(&dev->dev, "PME# %s\n", enable ? "enabled" : "disabled"); }