Hi,
nur der Vollständigkeit halber:
der 26er_branch vom saa kompiliert aber nur für "LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)" !
Im anderen Fall erfolgt eine "kfree(pmd)" -> siehe (B), obwohl gar kein "pmd" vorhanden -> siehe (A)!
Und an Stelle (B) sollte es deshalb eher "goto out_client;" heissen ...
Code: Alles auswählen
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
struct miscdevice *pmd = kcalloc(1,sizeof(struct miscdevice), GFP_KERNEL); // <---- (A) pmd gibts nur für >= 2.5er !
if (!pmd){
ret = -ENOMEM;
goto out_client;
}
pmd->name = (const char*)&encoder->name; /* entry must not change */
pmd->fops = &saa7126_fops;
pmd->minor = MISC_DYNAMIC_MINOR;
if ((ret=misc_register(pmd))<0){
printk("saa: unable to register device: Error %d\n",ret);
goto out_pmd;
}
encoder->mdev = pmd;
encoder->minor = pmd->minor;
#else
encoder->devfs_handle = devfs_register (NULL, encoder->name, DEVFS_FL_DEFAULT, 0, 0,
S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH,
&saa7126_fops, encoder);
if (!encoder->devfs_handle)
ret = -EIO;
goto out_pmd; // <---- (B) sollte eher "goto out_client;" heissen
#endif
if ((ret = i2c_attach_client(client))<0){
printk(KERN_ERR "saa: unable to attach client: Error %d\n",ret);
goto out_reg;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
if ((ret = devfs_mk_cdev(MKDEV(MISC_MAJOR,pmd->minor),
S_IFCHR | S_IRUGO | S_IWUGO, "dbox/saa%d", encoder->id))) {
goto out_reg;
}
list_add_tail(&encoder->lhead,&encoder_list);
#endif
dprintk("[%s]: chip found @ 0x%x\n", __FILE__, client->addr);
saa7126_write_inittab(client, 1); /* init */
/* set video mode */
saa7126_set_mode(client, mode);
return 0;
/* start of unwind block */
out_reg:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
misc_deregister(pmd);
#else
devfs_unregister(encoder->devfs_handle);
#endif
out_pmd:
kfree(pmd); // <---- (C) pmd ist im "2.4er"-Fall nicht bekannt !
out_client:
kfree(client);
return ret;
}
- GMo -