Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=052c50d91642f10e10c3c10837c89a7355881e76
Commit:     052c50d91642f10e10c3c10837c89a7355881e76
Parent:     024cf53089f7c8e58934407f07ca2a7b5bed3b06
Author:     Michael Krufky <[EMAIL PROTECTED]>
AuthorDate: Mon Jun 4 16:00:45 2007 -0300
Committer:  Mauro Carvalho Chehab <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 14:23:56 2007 -0300

    V4L/DVB (5743): Tuner: clean up kfree() after release
    
    Although it is safe to kfree(NULL), We only need to kfree(priv)
    if the release callback is undefined.  As it stands now, there
    is some redundancy in the operation of releasing the priv data
    structures. This patch will call kfree(priv) and set priv to NULL,
    if the release callback isnt defined.  Otherwise, let the release
    callback handle this itself.
    Thanks to Mauro Carvalho Chehab for suggesting this.
    
    Signed-off-by: Michael Krufky <[EMAIL PROTECTED]>
    Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
---
 drivers/media/video/tuner-core.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 0e71a22..acbffbf 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -180,8 +180,10 @@ static void set_type(struct i2c_client *c, unsigned int 
type,
        /* discard private data, in case set_type() was previously called */
        if (t->release)
                t->release(c);
-       kfree(t->priv);
-       t->priv = NULL;
+       else {
+               kfree(t->priv);
+               t->priv = NULL;
+       }
 
        switch (t->type) {
        case TUNER_MT2032:
@@ -566,7 +568,9 @@ static int tuner_detach(struct i2c_client *client)
 
        if (t->release)
                t->release(client);
-       kfree(t->priv);
+       else {
+               kfree(t->priv);
+       }
        kfree(t);
        return 0;
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to