]> git.sur5r.net Git - u-boot/commitdiff
* Fix memory leak in the NAND-specific JFFS2 code
authorwdenk <wdenk>
Wed, 5 May 2004 19:44:41 +0000 (19:44 +0000)
committerwdenk <wdenk>
Wed, 5 May 2004 19:44:41 +0000 (19:44 +0000)
* Fix SL811 USB controller when attached to a USB hub

CHANGELOG
drivers/sl811_usb.c
fs/jffs2/jffs2_1pass.c

index 235852a358bd49ea9754e9b102c52dc1f1620512..7532e7007dc79b40eb6534ab81d67831eaa970d7 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,10 @@
 Changes since U-Boot 1.1.1:
 ======================================================================
 
+* Fix memory leak in the NAND-specific JFFS2 code
+
+* Fix SL811 USB controller when attached to a USB hub
+
 * Fix config option spelling in PM520 config file
 
 * Fix PHY discovery problem in cpu/mpc8xx/fec.c (introduced by
index ce5afe0c34cb4d61468323a1a1c802f71f273c8f..5136cdc68d313d439df640b1ba117280b40ed0e9 100644 (file)
@@ -226,7 +226,12 @@ int usb_lowlevel_stop(void)
        return 0;
 }
 
-int sl811_send_packet(int dir_to_host, int data1, __u8 *buffer, int len)
+static int calc_needed_buswidth(int bytes, int low_speed)
+{
+       return bytes * 8 + 512;
+}
+
+static int sl811_send_packet(int dir_to_host, int data1, __u8 *buffer, int len)
 {
        __u8 ctrl = SL811_USB_CTRL_ARM | SL811_USB_CTRL_ENABLE;
        __u16 status = 0;
@@ -248,7 +253,7 @@ int sl811_send_packet(int dir_to_host, int data1, __u8 *buffer, int len)
                if (!dir_to_host && len)
                        sl811_write_buf(0x10, buffer, len);
 
-               if (sl811_read(SL811_SOFCNTDIV)*64 < len * 8 * 2)
+               if (sl811_read(SL811_SOFCNTDIV)*64 < calc_needed_buswidth(len, 0))
                        ctrl |= SL811_USB_CTRL_SOF;
                else
                        ctrl &= ~SL811_USB_CTRL_SOF;
@@ -494,7 +499,7 @@ static int ascii2utf (char *s, u8 *utf, int utfmax)
  * root_hub_string is used by each host controller's root hub code,
  * so that they're identified consistently throughout the system.
  */
-int usb_root_hub_string (int id, int serial, char *type, __u8 *data, int len)
+static int usb_root_hub_string (int id, int serial, char *type, __u8 *data, int len)
 {
        char buf [30];
 
@@ -503,7 +508,7 @@ int usb_root_hub_string (int id, int serial, char *type, __u8 *data, int len)
 
        /* language ids */
        if (id == 0) {
-               *data++ = 4; *data++ = 3;       /* 4 bytes data */
+               *data++ = 3; *data++ = 4;       /* 4 bytes data */
                *data++ = 0; *data++ = 0;       /* some language id */
                return 4;
 
index 7bfcc0484df5d0a276e59376e94a00c23b6f191c..24b446c1a5c124d107533f5a12b499098389cb16 100644 (file)
@@ -217,7 +217,8 @@ static void *get_fl_mem(u32 off, u32 size, void *ext_buf)
                return NULL;
        }
        if (read_nand_cached(off, size, buf) < 0) {
-               free(buf);
+               if (!ext_buf)
+                       free(buf);
                return NULL;
        }
 
@@ -756,9 +757,11 @@ jffs2_1pass_list_inodes(struct b_lists * pL, u32 pino)
                        while (b2) {
                                jNode = (struct jffs2_raw_inode *)
                                        get_fl_mem(b2->offset, sizeof(ojNode), &ojNode);
-                               if (jNode->ino == jDir->ino
-                                   && jNode->version >= i_version)
+                               if (jNode->ino == jDir->ino && jNode->version >= i_version) {
+                                       if (i)
+                                               put_fl_mem(i);  
                                        i = get_fl_mem(b2->offset, sizeof(*i), NULL);
+                               }
                                b2 = b2->next;
                        }