On Wed, Sep 26, 2007 at 03:40:26PM -0700, Mark Gross wrote:
Your } is in a strange place. It looks like it wants to join its friends
closer to the left margin ;-)
an enum would be better for this, especially as people are likely to add
new types, having to update QOS_NUM_CLASSES each time sucks.
min()/max() instead?
'target' might be a more meaningful variable name.
Just return misc_register(...); ?
This leaks. You'll have to scan down from i and clean up the kstrdup()
per qos_array element. Presently this will only free the first one to fail
registration.
kmalloc() under a spinlock. GFP_KERNEL implies __GFP_WAIT, which can
sleep. Slab debugging would have caught this, too.
And here also, still under the spinlock. You can probably rework the
locking just to protect the list, if you really need it at all, it
doesn't seem to matter anywhere else here.
no if() needed.
You also didn't spin_unlock_irqrestore() in the error path, so this bails
out with the lock held and IRQs disabled.
-