Changeset 29970


Ignore:
Timestamp:
2012-01-31T19:36:51+01:00 (6 years ago)
Author:
juhosg
Message:

ar71xx: use dynamically allocated partitions in wrt160nl_part

Location:
trunk/target/linux/ar71xx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/ar71xx/files/drivers/mtd/wrt160nl_part.c

    r29856 r29970  
    7878} __attribute__ ((packed)); 
    7979 
    80 static struct mtd_partition trx_parts[TRX_PARTS]; 
    81  
    8280#define WRT160NL_UBOOT_LEN      0x40000 
    8381#define WRT160NL_ART_LEN        0x10000 
     
    9189        struct trx_header *theader; 
    9290        struct uimage_header *uheader; 
     91        struct mtd_partition *trx_parts; 
    9392        size_t retlen; 
    9493        unsigned int kernel_len; 
     
    102101        art_len = max_t(unsigned int, master->erasesize, WRT160NL_ART_LEN); 
    103102 
     103        trx_parts = kzalloc(TRX_PARTS * sizeof(struct mtd_partition), 
     104                            GFP_KERNEL); 
     105        if (!trx_parts) { 
     106                ret = -ENOMEM; 
     107                goto out; 
     108        } 
     109 
    104110        header = vmalloc(sizeof(*header)); 
    105111        if (!header) { 
    106112                return -ENOMEM; 
    107                 goto out; 
     113                goto free_parts; 
    108114        } 
    109115 
     
    170176        trx_parts[5].mask_flags = 0; 
    171177 
     178        vfree(header); 
     179 
    172180        *pparts = trx_parts; 
    173         ret = TRX_PARTS; 
     181        return TRX_PARTS; 
    174182 
    175183free_hdr: 
    176184        vfree(header); 
     185free_parts: 
     186        kfree(trx_parts); 
    177187out: 
    178188        return ret; 
  • trunk/target/linux/ar71xx/patches-3.2/308-wrt160nl_part-3.2-fixes.patch

    r29868 r29970  
    11--- a/drivers/mtd/wrt160nl_part.c 
    22+++ b/drivers/mtd/wrt160nl_part.c 
    3 @@ -85,7 +85,7 @@ static struct mtd_partition trx_parts[TR 
     3@@ -83,7 +83,7 @@ struct wrt160nl_header { 
    44  
    55 static int wrt160nl_parse_partitions(struct mtd_info *master, 
Note: See TracChangeset for help on using the changeset viewer.