media: tm6000: cleanup trival coding style issues
- Delete seven error messages for a failed memory allocation - Adjust seven checks for null pointers - Use common error handling code in tm6000_usb_probe() - Adjust jump targets so that the function "kfree" will be always called with a non-null pointer. - Delete an initialisation for the local variable "dev" which became unnecessary with this refactoring. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cette révision appartient à :

révisé par
Mauro Carvalho Chehab

Parent
5bf24e08b6
révision
7e11d5027b
@@ -123,7 +123,7 @@ static int tm6000_start_stream(struct tm6000_core *dev)
|
||||
}
|
||||
|
||||
dvb->bulk_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (dvb->bulk_urb == NULL)
|
||||
if (!dvb->bulk_urb)
|
||||
return -ENOMEM;
|
||||
|
||||
pipe = usb_rcvbulkpipe(dev->udev, dev->bulk_in.endp->desc.bEndpointAddress
|
||||
@@ -133,9 +133,8 @@ static int tm6000_start_stream(struct tm6000_core *dev)
|
||||
size = size * 15; /* 512 x 8 or 12 or 15 */
|
||||
|
||||
dvb->bulk_urb->transfer_buffer = kzalloc(size, GFP_KERNEL);
|
||||
if (dvb->bulk_urb->transfer_buffer == NULL) {
|
||||
if (!dvb->bulk_urb->transfer_buffer) {
|
||||
usb_free_urb(dvb->bulk_urb);
|
||||
printk(KERN_ERR "tm6000: couldn't allocate transfer buffer!\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -361,7 +360,7 @@ static void unregister_dvb(struct tm6000_core *dev)
|
||||
{
|
||||
struct tm6000_dvb *dvb = dev->dvb;
|
||||
|
||||
if (dvb->bulk_urb != NULL) {
|
||||
if (dvb->bulk_urb) {
|
||||
struct urb *bulk_urb = dvb->bulk_urb;
|
||||
|
||||
kfree(bulk_urb->transfer_buffer);
|
||||
@@ -400,10 +399,8 @@ static int dvb_init(struct tm6000_core *dev)
|
||||
}
|
||||
|
||||
dvb = kzalloc(sizeof(struct tm6000_dvb), GFP_KERNEL);
|
||||
if (!dvb) {
|
||||
printk(KERN_INFO "Cannot allocate memory\n");
|
||||
if (!dvb)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
dev->dvb = dvb;
|
||||
|
||||
|
Référencer dans un nouveau ticket
Bloquer un utilisateur