diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2015-02-03 12:47:48 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-04-08 07:42:01 -0300 |
commit | a2bbf5d05918a3156e9854a7144a8b2806badb53 (patch) | |
tree | 65e0b5a38df1783e85cba3ffffa8c26833b3fadc /drivers/media/dvb-core | |
parent | 07d0e554b5d10522b4cd6448108c0ad16403fea6 (diff) | |
download | blackbird-obmc-linux-a2bbf5d05918a3156e9854a7144a8b2806badb53.tar.gz blackbird-obmc-linux-a2bbf5d05918a3156e9854a7144a8b2806badb53.zip |
[media] DVB: Less function calls in dvb_ca_en50221_init() after error detection
The functions "dvb_unregister_device" and "kfree" could still be called
by the dvb_ca_en50221_init() function in the case that a previous resource
allocation failed.
* Corresponding details could be improved by adjustments for jump targets.
* Let us delete also an unnecessary check for the variable "ca" there.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/dvb-core')
-rw-r--r-- | drivers/media/dvb-core/dvb_ca_en50221.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb-core/dvb_ca_en50221.c index 7a9dd25a4cce..72937756f60c 100644 --- a/drivers/media/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb-core/dvb_ca_en50221.c @@ -1678,14 +1678,14 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, /* initialise the system data */ if ((ca = kzalloc(sizeof(struct dvb_ca_private), GFP_KERNEL)) == NULL) { ret = -ENOMEM; - goto error; + goto exit; } ca->pub = pubca; ca->flags = flags; ca->slot_count = slot_count; if ((ca->slot_info = kcalloc(slot_count, sizeof(struct dvb_ca_slot), GFP_KERNEL)) == NULL) { ret = -ENOMEM; - goto error; + goto free_ca; } init_waitqueue_head(&ca->wait_queue); ca->open = 0; @@ -1696,7 +1696,7 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, /* register the DVB device */ ret = dvb_register_device(dvb_adapter, &ca->dvbdev, &dvbdev_ca, ca, DVB_DEVICE_CA); if (ret) - goto error; + goto free_slot_info; /* now initialise each slot */ for (i = 0; i < slot_count; i++) { @@ -1711,7 +1711,7 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, if (signal_pending(current)) { ret = -EINTR; - goto error; + goto unregister_device; } mb(); @@ -1722,16 +1722,17 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, ret = PTR_ERR(ca->thread); printk("dvb_ca_init: failed to start kernel_thread (%d)\n", ret); - goto error; + goto unregister_device; } return 0; -error: - if (ca != NULL) { - dvb_unregister_device(ca->dvbdev); - kfree(ca->slot_info); - kfree(ca); - } +unregister_device: + dvb_unregister_device(ca->dvbdev); +free_slot_info: + kfree(ca->slot_info); +free_ca: + kfree(ca); +exit: pubca->private = NULL; return ret; } |