V4L/DVB (3439a): media video stradis memory fix

memset clears once set structure, there is actually no need for memset,
because configure function do it for us.  Next, vfree(NULL) is legal, so
avoid useless labels.

Thanks Dave Jones for reporting this.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This commit is contained in:
Jiri Slaby 2006-01-24 13:15:06 -08:00 коммит произвёл Mauro Carvalho Chehab
Родитель 65f17ee28e
Коммит 805f123d50
1 изменённых файлов: 5 добавлений и 10 удалений

Просмотреть файл

@ -2012,7 +2012,6 @@ static int __devinit init_saa7146(struct pci_dev *pdev)
{
struct saa7146 *saa = pci_get_drvdata(pdev);
memset(saa, 0, sizeof(*saa));
saa->user = 0;
/* reset the saa7146 */
saawrite(0xffff0000, SAA7146_MC1);
@ -2062,16 +2061,16 @@ static int __devinit init_saa7146(struct pci_dev *pdev)
}
if (saa->audbuf == NULL && (saa->audbuf = vmalloc(65536)) == NULL) {
dev_err(&pdev->dev, "%d: malloc failed\n", saa->nr);
goto errvid;
goto errfree;
}
if (saa->osdbuf == NULL && (saa->osdbuf = vmalloc(131072)) == NULL) {
dev_err(&pdev->dev, "%d: malloc failed\n", saa->nr);
goto erraud;
goto errfree;
}
/* allocate 81920 byte buffer for clipping */
if ((saa->dmavid2 = kzalloc(VIDEO_CLIPMAP_SIZE, GFP_KERNEL)) == NULL) {
dev_err(&pdev->dev, "%d: clip kmalloc failed\n", saa->nr);
goto errosd;
goto errfree;
}
/* setup clipping registers */
saawrite(virt_to_bus(saa->dmavid2), SAA7146_BASE_EVEN2);
@ -2085,15 +2084,11 @@ static int __devinit init_saa7146(struct pci_dev *pdev)
I2CBusScan(saa);
return 0;
errosd:
errfree:
vfree(saa->osdbuf);
saa->osdbuf = NULL;
erraud:
vfree(saa->audbuf);
saa->audbuf = NULL;
errvid:
vfree(saa->vidbuf);
saa->vidbuf = NULL;
saa->audbuf = saa->osdbuf = saa->vidbuf = NULL;
err:
return -ENOMEM;
}