include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / drivers / firmware / dell_rbu.c
index 13946eb..3a44602 100644 (file)
@@ -36,6 +36,7 @@
  */
 #include <linux/init.h>
 #include <linux/module.h>
+#include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/errno.h>
 #include <linux/blkdev.h>
@@ -544,9 +545,12 @@ static void callbackfn_rbu(const struct firmware *fw, void *context)
 {
        rbu_data.entry_created = 0;
 
-       if (!fw || !fw->size)
+       if (!fw)
                return;
 
+       if (!fw->size)
+               goto out;
+
        spin_lock(&rbu_data.lock);
        if (!strcmp(image_type, "mono")) {
                if (!img_update_realloc(fw->size))
@@ -568,6 +572,8 @@ static void callbackfn_rbu(const struct firmware *fw, void *context)
        } else
                pr_debug("invalid image type specified.\n");
        spin_unlock(&rbu_data.lock);
+ out:
+       release_firmware(fw);
 }
 
 static ssize_t read_rbu_image_type(struct kobject *kobj,
@@ -576,7 +582,7 @@ static ssize_t read_rbu_image_type(struct kobject *kobj,
 {
        int size = 0;
        if (!pos)
-               size = sprintf(buffer, "%s\n", image_type);
+               size = scnprintf(buffer, count, "%s\n", image_type);
        return size;
 }
 
@@ -615,7 +621,7 @@ static ssize_t write_rbu_image_type(struct kobject *kobj,
                        spin_unlock(&rbu_data.lock);
                        req_firm_rc = request_firmware_nowait(THIS_MODULE,
                                FW_ACTION_NOHOTPLUG, "dell_rbu",
-                               &rbu_device->dev, &context,
+                               &rbu_device->dev, GFP_KERNEL, &context,
                                callbackfn_rbu);
                        if (req_firm_rc) {
                                printk(KERN_ERR
@@ -648,7 +654,7 @@ static ssize_t read_rbu_packet_size(struct kobject *kobj,
        int size = 0;
        if (!pos) {
                spin_lock(&rbu_data.lock);
-               size = sprintf(buffer, "%lu\n", rbu_data.packetsize);
+               size = scnprintf(buffer, count, "%lu\n", rbu_data.packetsize);
                spin_unlock(&rbu_data.lock);
        }
        return size;