From patchwork Fri Apr 10 15:25:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 47056 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4DD0E21416 for ; Fri, 10 Apr 2015 15:26:28 +0000 (UTC) Received: by wizk4 with SMTP id k4sf137810wiz.2 for ; Fri, 10 Apr 2015 08:26:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=Rehx77ok86cPnvV3jalCWZNLNnISMCaqiG78TbAP9Kk=; b=SAKAYijJW73LIzaYTK0GoC0tYWPA9UXz0C1Eu0hJiWh0QmLQx/bMlh5Ar4tAh21S5O gzH19q2UUWF36cjftwhibGZpFtknW88wuR+75BTDMrS9w40HGDidoZkRTGqgOKrI1AaK n7ZzTRkI/wdZdN6z9d9wFWCP3KBG1RksIDVibsMjNaEMuxmHbCvbD6/uxtYBAqvttuDf 6CJnW5gBEoOqnKmmZeXhVb03YKmr6WI3dRzjUCuQ5seGbFVLJn+A3KCf128S5R+DRVOg w/gtOv3tf/EgAZZt3vdmTDl/H29qBywafGhcAO8sSnjDQ77ZvAqUJP9qgYiSFc1mKjGo feUQ== X-Gm-Message-State: ALoCoQlhLkbRac5MBuAMqPTnbSoG+ePqTkEvJ67wyH15E1Udez0LN39MgDoh/lk3t792BR+XaRBa X-Received: by 10.112.181.166 with SMTP id dx6mr412494lbc.17.1428679587521; Fri, 10 Apr 2015 08:26:27 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.45.6 with SMTP id i6ls465558lam.10.gmail; Fri, 10 Apr 2015 08:26:27 -0700 (PDT) X-Received: by 10.152.22.104 with SMTP id c8mr1873729laf.87.1428679587281; Fri, 10 Apr 2015 08:26:27 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id lf11si1742241lac.24.2015.04.10.08.26.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Apr 2015 08:26:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by lbbuc2 with SMTP id uc2so16273508lbb.2 for ; Fri, 10 Apr 2015 08:26:26 -0700 (PDT) X-Received: by 10.112.199.133 with SMTP id jk5mr1991084lbc.32.1428679586839; Fri, 10 Apr 2015 08:26:26 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp1172514lbt; Fri, 10 Apr 2015 08:26:26 -0700 (PDT) X-Received: by 10.66.141.77 with SMTP id rm13mr3644004pab.14.1428679585049; Fri, 10 Apr 2015 08:26:25 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gv1si3369546pbd.199.2015.04.10.08.26.23; Fri, 10 Apr 2015 08:26:25 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756170AbbDJP0A (ORCPT + 27 others); Fri, 10 Apr 2015 11:26:00 -0400 Received: from mail-pd0-f174.google.com ([209.85.192.174]:35350 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755803AbbDJPZ5 (ORCPT ); Fri, 10 Apr 2015 11:25:57 -0400 Received: by pddn5 with SMTP id n5so25843848pdd.2 for ; Fri, 10 Apr 2015 08:25:56 -0700 (PDT) X-Received: by 10.68.205.226 with SMTP id lj2mr3564086pbc.52.1428679556742; Fri, 10 Apr 2015 08:25:56 -0700 (PDT) Received: from t430.cg.shawcable.net ([184.64.168.246]) by mx.google.com with ESMTPSA id nj7sm2588884pbc.36.2015.04.10.08.25.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 Apr 2015 08:25:51 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, zhang.chunyan@linaro.org, kaixu.xia@linaro.org Subject: [PATCH 1/2] coresight: etb10: Print size of buffer we fail to allocate Date: Fri, 10 Apr 2015 09:25:36 -0600 Message-Id: <1428679537-26590-2-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1428679537-26590-1-git-send-email-mathieu.poirier@linaro.org> References: <1428679537-26590-1-git-send-email-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mathieu.poirier@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Mark Brown When we initialise the ETB driver we attempt to allocate a buffer suitable for storing the data buffered in the hardware based on sizing information reported by the hardware. Unfortunately if the hardware is not properly configured (for example if power domains are not set up correctly) then we may read back a nonsensically large value and therefore the allocation will be too big to succeed. Print an error message showing the amount of memory we tried to allocate if the buffer allocation fails to help users diagnose such problems. Normally it is bad practice to print an error message on memory allocation failures since there are verbose core messages reported for this but in this case where the allocation size might be incorrect it is a useful hint. Signed-off-by: Mark Brown Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etb10.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 40049869aecd..46eb9f88a29f 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -462,8 +462,11 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) drvdata->buf = devm_kzalloc(dev, drvdata->buffer_depth * 4, GFP_KERNEL); - if (!drvdata->buf) + if (!drvdata->buf) { + dev_err(dev, "Failed to allocate %u bytes for buffer data\n", + drvdata->buffer_depth * 4); return -ENOMEM; + } desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL); if (!desc)