UBI: small debugging code optimization
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Tue, 12 May 2009 12:10:03 +0000 (15:10 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Fri, 17 Jul 2009 13:04:21 +0000 (16:04 +0300)
The @ubi->dbg_peb_buf is needed only when paranoid checks are
enabled, not when debugging in general is enabled.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
drivers/mtd/ubi/build.c
drivers/mtd/ubi/ubi.h

index a70530d..33c9aaf 100644 (file)
@@ -1015,7 +1015,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset)
        if (!ubi->peb_buf2)
                goto out_free;
 
        if (!ubi->peb_buf2)
                goto out_free;
 
-#ifdef CONFIG_MTD_UBI_DEBUG
+#ifdef CONFIG_MTD_UBI_DEBUG_PARANOID
        mutex_init(&ubi->dbg_buf_mutex);
        ubi->dbg_peb_buf = vmalloc(ubi->peb_size);
        if (!ubi->dbg_peb_buf)
        mutex_init(&ubi->dbg_buf_mutex);
        ubi->dbg_peb_buf = vmalloc(ubi->peb_size);
        if (!ubi->dbg_peb_buf)
@@ -1093,7 +1093,7 @@ out_detach:
 out_free:
        vfree(ubi->peb_buf1);
        vfree(ubi->peb_buf2);
 out_free:
        vfree(ubi->peb_buf1);
        vfree(ubi->peb_buf2);
-#ifdef CONFIG_MTD_UBI_DEBUG
+#ifdef CONFIG_MTD_UBI_DEBUG_PARANOID
        vfree(ubi->dbg_peb_buf);
 #endif
        kfree(ubi);
        vfree(ubi->dbg_peb_buf);
 #endif
        kfree(ubi);
@@ -1162,7 +1162,7 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway)
        put_mtd_device(ubi->mtd);
        vfree(ubi->peb_buf1);
        vfree(ubi->peb_buf2);
        put_mtd_device(ubi->mtd);
        vfree(ubi->peb_buf1);
        vfree(ubi->peb_buf2);
-#ifdef CONFIG_MTD_UBI_DEBUG
+#ifdef CONFIG_MTD_UBI_DEBUG_PARANOID
        vfree(ubi->dbg_peb_buf);
 #endif
        ubi_msg("mtd%d is detached from ubi%d", ubi->mtd->index, ubi->ubi_num);
        vfree(ubi->dbg_peb_buf);
 #endif
        ubi_msg("mtd%d is detached from ubi%d", ubi->mtd->index, ubi->ubi_num);
index bed7d50..564f93c 100644 (file)
@@ -452,7 +452,7 @@ struct ubi_device {
        void *peb_buf2;
        struct mutex buf_mutex;
        struct mutex ckvol_mutex;
        void *peb_buf2;
        struct mutex buf_mutex;
        struct mutex ckvol_mutex;
-#ifdef CONFIG_MTD_UBI_DEBUG
+#ifdef CONFIG_MTD_UBI_DEBUG_PARANOID
        void *dbg_peb_buf;
        struct mutex dbg_buf_mutex;
 #endif
        void *dbg_peb_buf;
        struct mutex dbg_buf_mutex;
 #endif