Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 197358
b: refs/heads/master
c: db31501
h: refs/heads/master
v: v3
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed May 11, 2010
1 parent ed9e8be commit a9e5cb6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 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: 56c341d7af78f6766238725f79a1773aca942795
refs/heads/master: db315014ff8148e73d10e927d14c962d2cabd370
11 changes: 4 additions & 7 deletions trunk/drivers/staging/batman-adv/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ static struct device_client *device_client_hash[256];

void bat_device_init(void)
{
int i;

for (i = 0; i < 256; i++)
device_client_hash[i] = NULL;
memset(device_client_hash, 0, sizeof(device_client_hash));
}

int bat_device_setup(void)
Expand Down Expand Up @@ -103,15 +100,15 @@ int bat_device_open(struct inode *inode, struct file *file)
if (!device_client)
return -ENOMEM;

for (i = 0; i < 256; i++) {
for (i = 0; i < ARRAY_SIZE(device_client_hash); i++) {
if (!device_client_hash[i]) {
device_client_hash[i] = device_client;
break;
}
}

if (device_client_hash[i] != device_client) {
printk(KERN_ERR "batman-adv:Error - can't add another packet client: maximum number of clients reached \n");
if (i == ARRAY_SIZE(device_client_hash)) {
printk(KERN_ERR "batman-adv:Error - can't add another packet client: maximum number of clients reached\n");
kfree(device_client);
return -EXFULL;
}
Expand Down

0 comments on commit a9e5cb6

Please sign in to comment.