[DVB patch 41/48] vfree() checking cleanups

Johannes Stezenbach
2005-03-22T01:56:31Z

[-- Attachment #1: dvb-janitor-vfree.patch --]
[-- Type: text/plain, Size: 2768 bytes --]

vfree() checking cleanups.

Signed-off by: James Lamanna <jlamanna@gmail.com>
Signed-off-by: Domen Puncer <domen@coderock.org>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

dvb-core/dmxdev.c | 16 +++++-----------
dvb-core/dvb_ca_en50221.c | 3 +--
ttpci/budget-core.c | 3 +--
3 files changed, 7 insertions(+), 15 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dmxdev.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dvb-core/dmxdev.c 2005-03-21 23:27:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dmxdev.c 2005-03-22 00:28:04.000000000 +0100
@@ -304,8 +304,7 @@ static int dvb_dmxdev_set_buffer_size(st
buf->size=size;
buf->pwrite=buf->pread=0;
spin_unlock_irq(&dmxdevfilter->dev->lock);
- if (mem)
- vfree(mem);
+ vfree(mem);

if (buf->size) {
mem=vmalloc(dmxdevfilter->buffer.size);
@@ -1129,15 +1128,10 @@ dvb_dmxdev_release(struct dmxdev *dmxdev
dvb_unregister_device(dmxdev->dvbdev);
dvb_unregister_device(dmxdev->dvr_dvbdev);

- if (dmxdev->filter) {
- vfree(dmxdev->filter);
- dmxdev->filter=NULL;
- }
-
- if (dmxdev->dvr) {
- vfree(dmxdev->dvr);
- dmxdev->dvr=NULL;
- }
+ vfree(dmxdev->filter);
+ dmxdev->filter=NULL;
+ vfree(dmxdev->dvr);
+ dmxdev->dvr=NULL;
dmxdev->demux->close(dmxdev->demux);
}
EXPORT_SYMBOL(dvb_dmxdev_release);
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/budget-core.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttpci/budget-core.c 2005-03-21 23:27:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/budget-core.c 2005-03-22 00:28:04.000000000 +0100
@@ -415,8 +415,7 @@ int ttpci_budget_init(struct budget *bud
err:
i2c_del_adapter(&budget->i2c_adap);

- if (budget->grabbing)
- vfree(budget->grabbing);
+ vfree(budget->grabbing);

dvb_unregister_adapter(budget->dvb_adapter);

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dvb-core/dvb_ca_en50221.c 2005-03-22 00:27:13.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_ca_en50221.c 2005-03-22 00:28:04.000000000 +0100
@@ -804,8 +804,7 @@ static int dvb_ca_en50221_slot_shutdown(
down_write(&ca->slot_info[slot].sem);
ca->pub->slot_shutdown(ca->pub, slot);
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_NONE;
- if (ca->slot_info[slot].rx_buffer.data)
- vfree(ca->slot_info[slot].rx_buffer.data);
+ vfree(ca->slot_info[slot].rx_buffer.data);
ca->slot_info[slot].rx_buffer.data = NULL;
up_write(&ca->slot_info[slot].sem);

--