public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Thornber <joe@fib011235813.fsnet.co.uk>
To: Joe Thornber <joe@fib011235813.fsnet.co.uk>
Cc: Linus Torvalds <torvalds@transmeta.com>,
	Linux Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH 7/10] dm: printk tgt->error if dm_table_add_target() fails.
Date: Wed, 8 Jan 2003 09:58:39 +0000	[thread overview]
Message-ID: <20030108095839.GH2063@reti> (raw)
In-Reply-To: <20030108095221.GA2063@reti>

printk tgt->error if dm_table_add_target() fails.
--- diff/drivers/md/dm-table.c	2003-01-02 11:26:35.000000000 +0000
+++ source/drivers/md/dm-table.c	2003-01-02 11:26:53.000000000 +0000
@@ -578,9 +578,8 @@
 int dm_table_add_target(struct dm_table *t, const char *type,
 			sector_t start, sector_t len, char *params)
 {
-	int r, argc;
+	int r = -EINVAL, argc;
 	char *argv[32];
-	struct target_type *tt;
 	struct dm_target *tgt;
 
 	if ((r = check_space(t)))
@@ -589,14 +588,13 @@
 	tgt = t->targets + t->num_targets;
 	memset(tgt, 0, sizeof(*tgt));
 
-	tt = dm_get_target_type(type);
-	if (!tt) {
+	tgt->type = dm_get_target_type(type);
+	if (!tgt->type) {
 		tgt->error = "unknown target type";
-		return -EINVAL;
+		goto bad;
 	}
 
 	tgt->table = t;
-	tgt->type = tt;
 	tgt->begin = start;
 	tgt->len = len;
 	tgt->error = "Unknown error";
@@ -605,23 +603,19 @@
 	 * Does this target adjoin the previous one ?
 	 */
 	if (!adjoin(t, tgt)) {
-		DMERR("Gap in table");
-		dm_put_target_type(tt);
-		return -EINVAL;
+		tgt->error = "Gap in table";
+		goto bad;
 	}
 
 	r = split_args(ARRAY_SIZE(argv), &argc, argv, params);
 	if (r) {
 		tgt->error = "couldn't split parameters";
-		dm_put_target_type(tt);
-		return r;
+		goto bad;
 	}
 
-	r = tt->ctr(tgt, argc, argv);
-	if (r) {
-		dm_put_target_type(tt);
-		return r;
-	}
+	r = tgt->type->ctr(tgt, argc, argv);
+	if (r)
+		goto bad;
 
 	t->highs[t->num_targets++] = tgt->begin + tgt->len - 1;
 
@@ -629,6 +623,11 @@
 	 * the merge fn apply the target level restrictions. */
 	combine_restrictions_low(&t->limits, &tgt->limits);
 	return 0;
+
+ bad:
+	printk(KERN_ERR DM_NAME ": %s\n", tgt->error);
+	dm_put_target_type(tgt->type);
+	return r;
 }
 
 static int setup_indexes(struct dm_table *t)

  parent reply	other threads:[~2003-01-08  9:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-08  9:52 device-mapper patchset 2.5.54-dm-1 Joe Thornber
2003-01-08  9:54 ` [PATCH 1/10] dm: Don't let the ioctl interface drop a suspended device Joe Thornber
2003-01-08  9:54 ` [PATCH 2/10] dm: Correct clone info initialisation Joe Thornber
2003-01-08  9:55 ` [PATCH 3/10] dm: Correct target_type reference counting Joe Thornber
2003-01-08  9:56 ` [PATCH 4/10] dm: rwlock_t -> rw_semaphore (fluff) Joe Thornber
2003-01-08  9:57 ` [PATCH 5/10] dm: Call dm_put_target_type() *after* calling the destructor Joe Thornber
2003-01-08  9:57 ` [PATCH 6/10] dm: Remove explicit returns from void fns (fluff) Joe Thornber
2003-01-08  9:58 ` Joe Thornber [this message]
2003-01-08  9:59 ` [PATCH 8/10] dm: Simplify error->map Joe Thornber
2003-01-08  9:59 ` [PATCH 9/10] dm: Export dm_table_get_mode() Joe Thornber
2003-01-08 10:00 ` [PATCH 10/10] dm: Remove redundant error checking Joe Thornber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030108095839.GH2063@reti \
    --to=joe@fib011235813.fsnet.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox