Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 23267
b: refs/heads/master
c: daf72f4
h: refs/heads/master
i:
  23265: fab4455
  23263: 3040724
v: v3
  • Loading branch information
Jean Delvare authored and Mauro Carvalho Chehab committed Mar 23, 2006
1 parent d224c72 commit 3232ce0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 22 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: 6eb5d9ca9f1496108cb86f2d9bfc2db5d9c796fe
refs/heads/master: daf72f408c66aee4ac939f614293a78841aa7717
38 changes: 17 additions & 21 deletions trunk/drivers/media/video/zoran_card.c
Original file line number Diff line number Diff line change
Expand Up @@ -995,10 +995,7 @@ test_interrupts (struct zoran *zr)
static int __devinit
zr36057_init (struct zoran *zr)
{
u32 *mem;
void *vdev;
unsigned mem_needed;
int j;
int j, err;
int two = 2;
int zero = 0;

Expand Down Expand Up @@ -1049,36 +1046,28 @@ zr36057_init (struct zoran *zr)

/* allocate memory *before* doing anything to the hardware
* in case allocation fails */
mem_needed = BUZ_NUM_STAT_COM * 4;
mem = kzalloc(mem_needed, GFP_KERNEL);
vdev = (void *) kmalloc(sizeof(struct video_device), GFP_KERNEL);
if (!mem || !vdev) {
zr->stat_com = kzalloc(BUZ_NUM_STAT_COM * 4, GFP_KERNEL);
zr->video_dev = kmalloc(sizeof(struct video_device), GFP_KERNEL);
if (!zr->stat_com || !zr->video_dev) {
dprintk(1,
KERN_ERR
"%s: zr36057_init() - kmalloc (STAT_COM) failed\n",
ZR_DEVNAME(zr));
kfree(vdev);
kfree(mem);
return -ENOMEM;
err = -ENOMEM;
goto exit_free;
}
zr->stat_com = mem;
for (j = 0; j < BUZ_NUM_STAT_COM; j++) {
zr->stat_com[j] = 1; /* mark as unavailable to zr36057 */
}

/*
* Now add the template and register the device unit.
*/
zr->video_dev = vdev;
memcpy(zr->video_dev, &zoran_template, sizeof(zoran_template));
strcpy(zr->video_dev->name, ZR_DEVNAME(zr));
if (video_register_device(zr->video_dev, VFL_TYPE_GRABBER,
video_nr) < 0) {
zoran_unregister_i2c(zr);
kfree((void *) zr->stat_com);
kfree(vdev);
return -1;
}
err = video_register_device(zr->video_dev, VFL_TYPE_GRABBER, video_nr);
if (err < 0)
goto exit_unregister;

zoran_init_hardware(zr);
if (*zr_debug > 2)
Expand All @@ -1092,6 +1081,13 @@ zr36057_init (struct zoran *zr)
zr->zoran_proc = NULL;
zr->initialized = 1;
return 0;

exit_unregister:
zoran_unregister_i2c(zr);
exit_free:
kfree(zr->stat_com);
kfree(zr->video_dev);
return err;
}

static void
Expand Down Expand Up @@ -1121,7 +1117,7 @@ zoran_release (struct zoran *zr)
btwrite(0, ZR36057_SPGPPCR);
free_irq(zr->pci_dev->irq, zr);
/* unmap and free memory */
kfree((void *) zr->stat_com);
kfree(zr->stat_com);
zoran_proc_cleanup(zr);
iounmap(zr->zr36057_mem);
pci_disable_device(zr->pci_dev);
Expand Down

0 comments on commit 3232ce0

Please sign in to comment.