All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dongliang Mu <mudongliangabcd@gmail.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Dongliang Mu <mudongliangabcd@gmail.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] media: dvb-usb: move kfree(d) to dvb_usb_device_exit
Date: Mon, 21 Jun 2021 13:07:27 +0800	[thread overview]
Message-ID: <20210621050729.3898275-2-mudongliangabcd@gmail.com> (raw)
In-Reply-To: <20210621050729.3898275-1-mudongliangabcd@gmail.com>

As d is allocated in dvb_usb_device_init, so move to the deallocation of
d from dvb_usb_exit to dvb_usb_device_exit

Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
---
 drivers/media/usb/dvb-usb/dvb-usb-init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/dvb-usb/dvb-usb-init.c b/drivers/media/usb/dvb-usb/dvb-usb-init.c
index edc477cedaa9..21ad51be4820 100644
--- a/drivers/media/usb/dvb-usb/dvb-usb-init.c
+++ b/drivers/media/usb/dvb-usb/dvb-usb-init.c
@@ -147,7 +147,6 @@ static int dvb_usb_exit(struct dvb_usb_device *d)
 		d->props.priv_destroy(d);
 
 	kfree(d->priv);
-	kfree(d);
 	return 0;
 }
 
@@ -333,9 +332,10 @@ void dvb_usb_device_exit(struct usb_interface *intf)
 	char name[40];
 
 	usb_set_intfdata(intf, NULL);
-	if (d != NULL && d->desc != NULL) {
+	if (d && d->desc) {
 		strscpy(name, d->desc->name, sizeof(name));
 		dvb_usb_exit(d);
+		kfree(d);
 	} else {
 		strscpy(name, default_name, sizeof(name));
 	}
-- 
2.25.1


  reply	other threads:[~2021-06-21  5:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-21  5:07 [PATCH 1/3] media: dvb-usb: break long strings in dvb_usb_device_init Dongliang Mu
2021-06-21  5:07 ` Dongliang Mu [this message]
2021-07-25 13:47   ` [PATCH 2/3] media: dvb-usb: move kfree(d) to dvb_usb_device_exit Sean Young
2021-06-21  5:07 ` [PATCH 3/3] media: dvb-usb: Fix error handling in dvb_usb_i2c_init Dongliang Mu
2021-06-21  7:05 ` [PATCH 1/3] media: dvb-usb: break long strings in dvb_usb_device_init kernel test robot
2021-06-21  7:05   ` kernel test robot
2021-06-21 11:38 ` kernel test robot
2021-06-21 11:38   ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210621050729.3898275-2-mudongliangabcd@gmail.com \
    --to=mudongliangabcd@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.