Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 205954
b: refs/heads/master
c: 05e2408
h: refs/heads/master
v: v3
  • Loading branch information
Ossama Othman authored and Greg Kroah-Hartman committed Jul 22, 2010
1 parent 75037cb commit f434156
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 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: 4cae2597f5455a3c8ffc6c200b34e15c83184579
refs/heads/master: 05e2408d4324ae132eda6530cce0aa24e79f0c41
28 changes: 19 additions & 9 deletions trunk/drivers/staging/memrar/memrar_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,6 @@ static int memrar_init_rar_resources(int rarnum, char const *devname)
BUG_ON(!memrar_is_valid_rar_type(rarnum));
BUG_ON(rar->allocated);

mutex_init(&rar->lock);

/*
* Initialize the process table before we reach any
* code that exit on failure since the finalization
* code requires an initialized list.
*/
INIT_LIST_HEAD(&rar->buffers.list);

if (rar_get_address(rarnum, &low, &high) != 0)
/* No RAR is available. */
return -ENODEV;
Expand Down Expand Up @@ -941,9 +932,28 @@ static int memrar_registration_callback(unsigned long rar)
static int __init memrar_init(void)
{
int err;
int i;

printk(banner);

/*
* Some delayed initialization is performed in this driver.
* Make sure resources that are used during driver clean-up
* (e.g. during driver's release() function) are fully
* initialized before first use. This is particularly
* important for the case when the delayed initialization
* isn't completed, leaving behind a partially initialized
* driver.
*
* Such a scenario can occur when RAR is not available on the
* platform, and the driver is release()d.
*/
for (i = 0; i != ARRAY_SIZE(memrars); ++i) {
struct memrar_rar_info * const rar = &memrars[i];
mutex_init(&rar->lock);
INIT_LIST_HEAD(&rar->buffers.list);
}

err = misc_register(&memrar_miscdev);
if (err)
return err;
Expand Down

0 comments on commit f434156

Please sign in to comment.