From patchwork Mon Apr 15 09:46:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sanjay Singh Rawat X-Patchwork-Id: 16132 Return-Path: X-Original-To: linaro@staging.patches.linaro.org Delivered-To: linaro@staging.patches.linaro.org Received: from mail-yh0-f70.google.com (mail-yh0-f70.google.com [209.85.213.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C7FDD23934 for ; Mon, 15 Apr 2013 09:47:33 +0000 (UTC) Received: by mail-yh0-f70.google.com with SMTP id b41sf7375283yha.1 for ; Mon, 15 Apr 2013 02:47:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=MoGsRHNddzv6SCguxxpUp296zUmHoHlO/d93qqNpl/E=; b=hK0R47kDn5M6omTefZcv8o2I0VI6lpRhdacPIpaSxm6hoHnblampCwVbsAwu7/hvSK P8yWMiVcIKTRuCWinF1m2ENBNsTYhCoqi73zK17Qfm79qRXa6qawbNdFVlqfxHZG/DC0 09sUIacrYUwSvFRbtfRZAHVWAQoxRq+2+3N8HanPVhgzCM/I7gEZqyyNhWJbzlI1V+S7 5HSnvx8ZOnwhG66L3l+GV7rVemQ5F4choFHLf25F70ukjYMMkvT+BisoDTIA7VuXtUIY khwWgAiqIFCGaOGUAzr4ixfe7HEvUkxFWheN0APKpR/9NrzhGVs/7UEyV7KwxauwY33k 1v0A== X-Received: by 10.224.65.6 with SMTP id g6mr12909794qai.4.1366019223200; Mon, 15 Apr 2013 02:47:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.4.71 with SMTP id i7ls1193094qei.86.gmail; Mon, 15 Apr 2013 02:47:03 -0700 (PDT) X-Received: by 10.52.35.110 with SMTP id g14mr5540903vdj.61.1366019223071; Mon, 15 Apr 2013 02:47:03 -0700 (PDT) Received: from mail-vb0-x236.google.com (mail-vb0-x236.google.com [2607:f8b0:400c:c02::236]) by mx.google.com with ESMTPS id n6si12746003vcw.35.2013.04.15.02.47.03 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Apr 2013 02:47:03 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::236 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::236; Received: by mail-vb0-f54.google.com with SMTP id w16so3655147vbf.27 for ; Mon, 15 Apr 2013 02:47:03 -0700 (PDT) X-Received: by 10.221.0.199 with SMTP id nn7mr15646282vcb.14.1366019222863; Mon, 15 Apr 2013 02:47:02 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp158566veb; Mon, 15 Apr 2013 02:47:02 -0700 (PDT) X-Received: by 10.205.43.197 with SMTP id ud5mr1008952bkb.126.1366019221521; Mon, 15 Apr 2013 02:47:01 -0700 (PDT) Received: from mail-bk0-x234.google.com (mail-bk0-x234.google.com [2a00:1450:4008:c01::234]) by mx.google.com with ESMTPS id hg14si7407837bkc.170.2013.04.15.02.47.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Apr 2013 02:47:01 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:4008:c01::234 is neither permitted nor denied by best guess record for domain of sanjay.rawat@linaro.org) client-ip=2a00:1450:4008:c01::234; Received: by mail-bk0-f52.google.com with SMTP id it16so2232371bkc.39 for ; Mon, 15 Apr 2013 02:47:00 -0700 (PDT) X-Received: by 10.205.134.3 with SMTP id ia3mr7904078bkc.92.1366019220602; Mon, 15 Apr 2013 02:47:00 -0700 (PDT) Received: from srawat-Latitude-E6420.LGE.NET ([203.247.149.152]) by mx.google.com with ESMTPS id fs20sm8089894bkc.8.2013.04.15.02.46.55 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Apr 2013 02:46:59 -0700 (PDT) From: Sanjay Singh Rawat To: linaro-dev@lists.linaro.org Cc: patches@linaro.org, Sanjay Singh Rawat Subject: [PATCH powerdebug] display proper error message Date: Mon, 15 Apr 2013 15:16:49 +0530 Message-Id: <1366019209-18330-1-git-send-email-sanjay.rawat@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQktiwIlWMzqIpa67FjV1SxZxh2Zv0IAD9QHbYceQ3GT9E06YeSO+ydbcJ+uCuJeGG9ZPbPQ X-Original-Sender: sanjay.rawat@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::236 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , - bug : https://bugs.launchpad.net/linaro-powerdebug/+bug/1014667 Signed-off-by: Sanjay Singh Rawat --- display.c | 4 +++- powerdebug.c | 2 +- regulator.c | 4 +++- tree.c | 4 +++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/display.c b/display.c index f06387c..39a8e71 100644 --- a/display.c +++ b/display.c @@ -593,8 +593,10 @@ int display_register(int win, struct display_ops *ops) { size_t array_size = sizeof(windata) / sizeof(windata[0]); - if (win < 0 || win >= array_size) + if (win < 0 || win >= array_size) { + printf("error: invalid window"); return -1; + } windata[win].ops = ops; diff --git a/powerdebug.c b/powerdebug.c index 073fd42..ca04fab 100644 --- a/powerdebug.c +++ b/powerdebug.c @@ -243,7 +243,7 @@ int main(int argc, char **argv) } if (regulator_init()) { - printf("not enough memory to allocate regulators info\n"); + printf("failed to initialize regulator\n"); options->regulators = false; } diff --git a/regulator.c b/regulator.c index 0da924a..68c686f 100644 --- a/regulator.c +++ b/regulator.c @@ -218,8 +218,10 @@ static int fill_regulator_cb(struct tree *t, void *data) struct regulator_info *reg; reg = regulator_alloc(); - if (!reg) + if (!reg) { + printf("error: unable to allocate memory for regulator\n"); return -1; + } t->private = reg; /* we skip the root node but we set it expanded for its children */ diff --git a/tree.c b/tree.c index d331c60..686e846 100644 --- a/tree.c +++ b/tree.c @@ -121,8 +121,10 @@ static int tree_scan(struct tree *tree, tree_filter_t filter, bool follow) int ret = 0; dir = opendir(tree->path); - if (!dir) + if (!dir) { + printf("error: unable to open directory %s\n", tree->path); return -1; + } while (!readdir_r(dir, &dirent, &direntp)) {