Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 195331
b: refs/heads/master
c: aae86e8
h: refs/heads/master
i:
  195329: 139c79e
  195327: 184b646
v: v3
  • Loading branch information
Michal Nazarewicz authored and Greg Kroah-Hartman committed May 20, 2010
1 parent e0e473c commit 9dea06f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ddb495d4d81dee4fdd96ae397d60ddefd65204c6
refs/heads/master: aae86e8adb3bbf5256eebe76500cf7254365753c
23 changes: 18 additions & 5 deletions trunk/drivers/usb/gadget/f_mass_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ static const char fsg_string_interface[] = "Mass Storage";


#define FSG_NO_INTR_EP 1
#define FSG_BUFFHD_STATIC_BUFFER 1
#define FSG_NO_DEVICE_STRINGS 1
#define FSG_NO_OTG 1
#define FSG_NO_INTR_EP 1
Expand Down Expand Up @@ -2762,13 +2761,19 @@ static struct fsg_common *fsg_common_init(struct fsg_common *common,


/* Data buffers cyclic list */
/* Buffers in buffhds are static -- no need for additional
* allocation. */
bh = common->buffhds;
i = FSG_NUM_BUFFERS - 1;
i = FSG_NUM_BUFFERS;
goto buffhds_first_it;
do {
bh->next = bh + 1;
} while (++bh, --i);
++bh;
buffhds_first_it:
bh->buf = kmalloc(FSG_BUFLEN, GFP_KERNEL);
if (unlikely(!bh->buf)) {
rc = -ENOMEM;
goto error_release;
}
} while (--i);
bh->next = common->buffhds;


Expand Down Expand Up @@ -2871,6 +2876,7 @@ static void fsg_common_release(struct kref *ref)
container_of(ref, struct fsg_common, ref);
unsigned i = common->nluns;
struct fsg_lun *lun = common->luns;
struct fsg_buffhd *bh;

/* If the thread isn't already dead, tell it to exit now */
if (common->state != FSG_STATE_TERMINATED) {
Expand All @@ -2892,6 +2898,13 @@ static void fsg_common_release(struct kref *ref)
}

kfree(common->luns);

i = FSG_NUM_BUFFERS;
bh = common->buffhds;
do {
kfree(bh->buf);
} while (++bh, --i);

if (common->free_storage_on_release)
kfree(common);
}
Expand Down

0 comments on commit 9dea06f

Please sign in to comment.