From patchwork Mon Sep 8 04:28:24 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 196 Return-Path: X-Original-To: patchwork@ozlabs.org Delivered-To: patchwork@ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B12A2DDDFA for ; Mon, 8 Sep 2008 14:28:35 +1000 (EST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.68 #1 (Red Hat Linux)) id 1KcYMW-0002KB-Ti; Mon, 08 Sep 2008 04:28:28 +0000 Received: from relay03.pair.com ([209.68.5.17]) by bombadil.infradead.org with smtp (Exim 4.68 #1 (Red Hat Linux)) id 1KcYMU-0002K5-SF for linux-mtd@lists.infradead.org; Mon, 08 Sep 2008 04:28:27 +0000 Received: (qmail 51362 invoked by uid 0); 8 Sep 2008 04:28:25 -0000 Received: from unknown (HELO localhost.localdomain) (unknown) by unknown with SMTP; 8 Sep 2008 04:28:25 -0000 X-pair-Authenticated: 66.134.71.115 From: Grant Erickson To: linux-mtd@lists.infradead.org Subject: [PATCH 2/6] [MTD-UTILS] nandwrite: Utilize Standard Exit Mnemonics Date: Sun, 7 Sep 2008 21:28:24 -0700 Message-Id: <1220848104-22284-1-git-send-email-gerickson@nuovations.com> X-Mailer: git-send-email 1.6.0.1 Organization: Nuovation System Designs, LLC X-Spam-Score: -1.0 (-) X-Spam-Report: SpamAssassin version 3.2.5 on bombadil.infradead.org summary: Content analysis details: (-1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.68.5.17 listed in list.dnswl.org] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.9 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+patchwork=ozlabs.org@lists.infradead.org Replace main exit and return status codes with equivalent mnemonics. Signed-off-by: Grant Erickson diff --git a/nandwrite.c b/nandwrite.c index 8e0609d..b1a4307 100644 --- a/nandwrite.c +++ b/nandwrite.c @@ -103,7 +103,7 @@ static void display_version (void) "You may redistribute copies of " PROGRAM "\n" "under the terms of the GNU General Public Licence.\n" "See the file `COPYING' for more information.\n"); - exit(0); + exit (EXIT_SUCCESS); } static const char *mtd_device, *img; @@ -225,20 +225,20 @@ int main(int argc, char * const argv[]) if (pad && writeoob) { fprintf(stderr, "Can't pad when oob data is present.\n"); - exit(1); + exit (EXIT_FAILURE); } /* Open the device */ if ((fd = open(mtd_device, O_RDWR)) == -1) { perror("open flash"); - exit(1); + exit (EXIT_FAILURE); } /* Fill in MTD device capability structure */ if (ioctl(fd, MEMGETINFO, &meminfo) != 0) { perror("MEMGETINFO"); close(fd); - exit(1); + exit (EXIT_FAILURE); } /* Set erasesize to specified number of blocks - to match jffs2 @@ -252,7 +252,7 @@ int main(int argc, char * const argv[]) !(meminfo.oobsize == 128 && meminfo.writesize == 4096)) { fprintf(stderr, "Unknown flash (not normal NAND)\n"); close(fd); - exit(1); + exit (EXIT_FAILURE); } if (autoplace) { @@ -260,7 +260,7 @@ int main(int argc, char * const argv[]) if (ioctl (fd, MEMGETOOBSEL, &old_oobinfo) != 0) { perror ("MEMGETOOBSEL"); close (fd); - exit (1); + exit (EXIT_FAILURE); } // autoplace ECC ? @@ -269,7 +269,7 @@ int main(int argc, char * const argv[]) if (ioctl (fd, MEMSETOOBSEL, &autoplace_oobinfo) != 0) { perror ("MEMSETOOBSEL"); close (fd); - exit (1); + exit (EXIT_FAILURE); } oobinfochanged = 1; } @@ -285,19 +285,19 @@ int main(int argc, char * const argv[]) if (ioctl (fd, MEMGETOOBSEL, &old_oobinfo) != 0) { perror ("MEMGETOOBSEL"); close (fd); - exit (1); + exit (EXIT_FAILURE); } if (ioctl (fd, MEMSETOOBSEL, &none_oobinfo) != 0) { perror ("MEMSETOOBSEL"); close (fd); - exit (1); + exit (EXIT_FAILURE); } oobinfochanged = 1; break; default: perror ("MTDFILEMODE"); close (fd); - exit (1); + exit (EXIT_FAILURE); } } } @@ -506,7 +506,7 @@ restoreoob: if (ioctl (fd, MEMSETOOBSEL, &old_oobinfo) != 0) { perror ("MEMSETOOBSEL"); close (fd); - exit (1); + exit (EXIT_FAILURE); } } @@ -514,9 +514,9 @@ restoreoob: if (imglen > 0) { perror ("Data was only partially written due to error\n"); - exit (1); + exit (EXIT_FAILURE); } /* Return happy */ - return 0; + return EXIT_SUCCESS; }