aoe: make error messages more specific
authorEd L. Cashin <ecashin@coraid.com>
Fri, 8 Feb 2008 12:20:09 +0000 (04:20 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Fri, 8 Feb 2008 17:22:32 +0000 (09:22 -0800)
Andrew Morton pointed out that the "too many targets" message in patch 2 could
be printed for failing GFP_ATOMIC allocations.  This patch makes the messages
more specific.

Signed-off-by: Ed L. Cashin <ecashin@coraid.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/block/aoe/aoecmd.c

index bcea36c87d04dcd86734df58af5bcf4c9e5196b2..1e37cf6d92147a13f4ce619313a34ec49ee6b813 100644 (file)
@@ -957,15 +957,17 @@ addtgt(struct aoedev *d, char *addr, ulong nframes)
        for (; tt < te && *tt; tt++)
                ;
 
-       if (tt == te)
+       if (tt == te) {
+               printk(KERN_INFO
+                       "aoe: device addtgt failure; too many targets\n");
                return NULL;
-
+       }
        t = kcalloc(1, sizeof *t, GFP_ATOMIC);
-       if (!t)
-               return NULL;
        f = kcalloc(nframes, sizeof *f, GFP_ATOMIC);
-       if (!f) {
+       if (!t || !f) {
+               kfree(f);
                kfree(t);
+               printk(KERN_INFO "aoe: cannot allocate memory to add target\n");
                return NULL;
        }
 
@@ -1029,9 +1031,6 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
        if (!t) {
                t = addtgt(d, h->src, n);
                if (!t) {
-                       printk(KERN_INFO
-                               "aoe: device addtgt failure; "
-                               "too many targets?\n");
                        spin_unlock_irqrestore(&d->lock, flags);
                        return;
                }