Merge tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso...
[linux-2.6-microblaze.git] / drivers / media / rc / rc-main.c
index 7dfc7c2..8e7f292 100644 (file)
@@ -130,13 +130,18 @@ static struct rc_map_list empty_map = {
 static int ir_create_table(struct rc_map *rc_map,
                           const char *name, u64 rc_type, size_t size)
 {
-       rc_map->name = name;
+       rc_map->name = kstrdup(name, GFP_KERNEL);
+       if (!rc_map->name)
+               return -ENOMEM;
        rc_map->rc_type = rc_type;
        rc_map->alloc = roundup_pow_of_two(size * sizeof(struct rc_map_table));
        rc_map->size = rc_map->alloc / sizeof(struct rc_map_table);
        rc_map->scan = kmalloc(rc_map->alloc, GFP_KERNEL);
-       if (!rc_map->scan)
+       if (!rc_map->scan) {
+               kfree(rc_map->name);
+               rc_map->name = NULL;
                return -ENOMEM;
+       }
 
        IR_dprintk(1, "Allocated space for %u keycode entries (%u bytes)\n",
                   rc_map->size, rc_map->alloc);
@@ -153,6 +158,7 @@ static int ir_create_table(struct rc_map *rc_map,
 static void ir_free_table(struct rc_map *rc_map)
 {
        rc_map->size = 0;
+       kfree(rc_map->name);
        kfree(rc_map->scan);
        rc_map->scan = NULL;
 }
@@ -804,6 +810,7 @@ static const struct {
        { RC_BIT_SHARP,         "sharp",        "ir-sharp-decoder"      },
        { RC_BIT_MCE_KBD,       "mce_kbd",      "ir-mce_kbd-decoder"    },
        { RC_BIT_XMP,           "xmp",          "ir-xmp-decoder"        },
+       { RC_BIT_CEC,           "cec",          NULL                    },
 };
 
 /**