From: FabF <Fabian.Frederick@skynet.be>
To: Andrew Morton <akpm@osdl.org>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: [2.6.6-rc3-mm2] genhd-unregister warn handling
Date: Thu, 06 May 2004 20:02:43 +0200 [thread overview]
Message-ID: <1083866562.5865.6.camel@bluerhyme.real3> (raw)
[-- Attachment #1: Type: text/plain, Size: 223 bytes --]
Andrew,
Here's a patch against 2.6.6-rc3-mm2 genhd.c unregister_blkdev
-Standardize function for void xxx
-Split uncorresponding return
-Add printks
-Merge kfree to positive case
Could you apply ?
Regards,
Fabian
[-- Attachment #2: genhd1.diff --]
[-- Type: text/x-patch, Size: 1876 bytes --]
diff -Naur orig/drivers/block/genhd.c edited/drivers/block/genhd.c
--- orig/drivers/block/genhd.c 2004-04-04 05:37:06.000000000 +0200
+++ edited/drivers/block/genhd.c 2004-05-06 19:52:56.000000000 +0200
@@ -116,31 +116,33 @@
EXPORT_SYMBOL(register_blkdev);
-/* todo: make void - error printk here */
-int unregister_blkdev(unsigned int major, const char *name)
+void unregister_blkdev(unsigned int major, const char *name)
{
struct blk_major_name **n;
struct blk_major_name *p = NULL;
int index = major_to_index(major);
unsigned long flags;
- int ret = 0;
down_write(&block_subsys.rwsem);
spin_lock_irqsave(&major_names_lock, flags);
for (n = &major_names[index]; *n; n = &(*n)->next)
if ((*n)->major == major)
break;
- if (!*n || strcmp((*n)->name, name))
- ret = -EINVAL;
+ if (!*n)
+ printk(KERN_WARNING "Unable to unregister block device with major %d", major);
else {
- p = *n;
- *n = p->next;
+ if (strcmp((*n)->name, name))
+ printk(KERN_WARNING "Unable to unregister %s.Major name does not correspond", name);
+ else {
+ /*name was found in blk_major_name table.Skip it*/
+ p = *n;
+ *n = p->next;
+ kfree(p);
+ }
}
spin_unlock_irqrestore(&major_names_lock, flags);
up_write(&block_subsys.rwsem);
- kfree(p);
- return ret;
}
EXPORT_SYMBOL(unregister_blkdev);
diff -Naur orig/include/linux/fs.h edited/include/linux/fs.h
--- orig/include/linux/fs.h 2004-05-05 17:58:57.000000000 +0200
+++ edited/include/linux/fs.h 2004-05-06 19:19:26.000000000 +0200
@@ -1216,7 +1216,7 @@
#endif
extern int register_blkdev(unsigned int, const char *);
-extern int unregister_blkdev(unsigned int, const char *);
+extern void unregister_blkdev(unsigned int, const char *);
extern struct block_device *bdget(dev_t);
extern void bd_set_size(struct block_device *, loff_t size);
extern void bd_forget(struct inode *inode);
next reply other threads:[~2004-05-06 17:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-06 18:02 FabF [this message]
2004-05-06 21:40 ` Andrew Morton
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=1083866562.5865.6.camel@bluerhyme.real3 \
--to=fabian.frederick@skynet.be \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®