firmware_class: Fix the file size check
[pandora-kernel.git] / drivers / base / firmware_class.c
index 6579774..8a97ddf 100644 (file)
@@ -99,7 +99,11 @@ static inline long firmware_loading_timeout(void)
 /* firmware behavior options */
 #define FW_OPT_UEVENT  (1U << 0)
 #define FW_OPT_NOWAIT  (1U << 1)
+#ifdef CONFIG_FW_LOADER_USER_HELPER
 #define FW_OPT_FALLBACK        (1U << 2)
+#else
+#define FW_OPT_FALLBACK        0
+#endif
 
 struct firmware_cache {
        /* firmware_buf instance will be added into the below list */
@@ -224,6 +228,7 @@ static int fw_lookup_and_allocate_buf(const char *fw_name,
 }
 
 static void __fw_free_buf(struct kref *ref)
+       __releases(&fwc->lock)
 {
        struct firmware_buf *buf = to_fwbuf(ref);
        struct firmware_cache *fwc = buf->fwc;
@@ -275,21 +280,21 @@ module_param_string(path, fw_path_para, sizeof(fw_path_para), 0644);
 MODULE_PARM_DESC(path, "customized firmware image search path with a higher priority than default path");
 
 /* Don't inline this: 'struct kstat' is biggish */
-static noinline_for_stack long fw_file_size(struct file *file)
+static noinline_for_stack int fw_file_size(struct file *file)
 {
        struct kstat st;
        if (vfs_getattr(&file->f_path, &st))
                return -1;
        if (!S_ISREG(st.mode))
                return -1;
-       if (st.size != (long)st.size)
+       if (st.size != (int)st.size)
                return -1;
        return st.size;
 }
 
 static int fw_read_file_contents(struct file *file, struct firmware_buf *fw_buf)
 {
-       long size;
+       int size;
        char *buf;
        int rc;