summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-04-08 11:32:44 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2011-04-12 09:54:56 +0200
commitf880d7bc875bc4165a9de8ad81ecf1ccb8307af7 (patch)
tree9592cc3cbda3d22fb4818ff6a7fb77e75e3dff13 /commands
parente7c06800ee4c8d780b7a701346def7b08414fc63 (diff)
downloadbarebox-f880d7bc875bc4165a9de8ad81ecf1ccb8307af7.tar.gz
barebox-f880d7bc875bc4165a9de8ad81ecf1ccb8307af7.tar.xz
nand bb: add proper bb remove function
The old way happily removed cdev entries which were no bb dev at all. Fix this by checking if the given device actually is a bb device. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/nand.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/commands/nand.c b/commands/nand.c
index ed55625edd..88f242df0f 100644
--- a/commands/nand.c
+++ b/commands/nand.c
@@ -39,7 +39,6 @@
static int do_nand(struct command *cmdtp, int argc, char *argv[])
{
int opt;
- struct nand_bb *bb;
int command = 0, badblock = 0;
while((opt = getopt(argc, argv, "adb:")) > 0) {
@@ -72,17 +71,7 @@ static int do_nand(struct command *cmdtp, int argc, char *argv[])
if (command & NAND_DEL) {
while (optind < argc) {
- struct cdev *cdev;
-
- cdev = cdev_by_name(basename(argv[optind]));
- if (!cdev) {
- printf("no such device: %s\n", argv[optind]);
- return 1;
- }
- bb = cdev->priv;
- close(bb->fd);
- devfs_remove(cdev);
- free(bb);
+ dev_remove_bb_dev(basename(argv[optind]));
optind++;
}
}