From patchwork Thu Jan 26 07:31:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 137893 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 14C99B6F68 for ; Thu, 26 Jan 2012 18:32:37 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1RqJny-0005yU-Hx; Thu, 26 Jan 2012 07:31:34 +0000 Received: from mail-pw0-f49.google.com ([209.85.160.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1RqJnv-0005yC-JT for linux-mtd@lists.infradead.org; Thu, 26 Jan 2012 07:31:32 +0000 Received: by pbdx9 with SMTP id x9so595101pbd.36 for ; Wed, 25 Jan 2012 23:31:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=jSXGn3uBC+vGkCEG69aq3Hd7kVCufnm5SvVVc5yl25Q=; b=embN2TZp2mEiHZDmTZ1IdTbyZI68bfBjredR43iJhEX1gURI0J607T2zCPbfUAHlZ+ S4mWdxiO6cRsfHkxD1dC/sV3EghgMfye5v3hQpICVq4jdACHWtqzj/6/ePIn3XQUjnXX 3KMNwDrFHHKza9fWHHN8xijeOqY5oW9Hc838c= Received: by 10.68.208.196 with SMTP id mg4mr2755213pbc.108.1327563090088; Wed, 25 Jan 2012 23:31:30 -0800 (PST) Received: from localhost.localdomain (5520-maca-inet1-outside.broadcom.com. [216.31.211.11]) by mx.google.com with ESMTPS id j4sm9004739pbg.12.2012.01.25.23.31.28 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Jan 2012 23:31:29 -0800 (PST) From: Brian Norris To: Subject: [PATCH 2/2] ubinfo: fix `--all' for non-consecutive device numbers Date: Wed, 25 Jan 2012 23:31:50 -0800 Message-Id: <1327563110-23966-2-git-send-email-computersforpeace@gmail.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1327563110-23966-1-git-send-email-computersforpeace@gmail.com> References: <1327563110-23966-1-git-send-email-computersforpeace@gmail.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (computersforpeace[at]gmail.com) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.160.49 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Brian Foster , Brian Norris , Artem Bityutskiy X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org When we have assigned non-consecutive device numbers to our UBI devices, then we run `ubinfo --all', we get errors once ubinfo tries to process the devices in the "hole". For instance, suppose there are two UBI devices, /dev/ubi0 and /dev/ubi10; then, ubinfo will fail trying to open /dev/ubi1 with: ubinfo: error!: cannot get information about UBI device 1 error 2 (No such file or directory) This patch adds a check to first see if device is present, then continue to the next ID if it doesn't exist. Reported-by: Brian Foster Signed-off-by: Brian Norris --- ubi-utils/ubinfo.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/ubi-utils/ubinfo.c b/ubi-utils/ubinfo.c index 7aa4aa4..cb88f53 100644 --- a/ubi-utils/ubinfo.c +++ b/ubi-utils/ubinfo.c @@ -362,6 +362,8 @@ static int print_general_info(libubi_t libubi, int all) for (i = ubi_info.lowest_dev_num; i <= ubi_info.highest_dev_num; i++) { + if (!ubi_dev_present(libubi, i)) + continue; if(!first) printf("\n===================================\n\n"); first = 0;