All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Young <sean@mess.org>
To: Dongliang Mu <mudongliangabcd@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] media: dvb-usb: move kfree(d) to dvb_usb_device_exit
Date: Sun, 25 Jul 2021 14:47:37 +0100	[thread overview]
Message-ID: <20210725134737.GA9696@gofer.mess.org> (raw)
In-Reply-To: <20210621050729.3898275-2-mudongliangabcd@gmail.com>

On Mon, Jun 21, 2021 at 01:07:27PM +0800, Dongliang Mu wrote:
> 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

There is nothing wrong with this patch, however I'm not sure what this
improves though. The code is just as good/messy as before, is it not?

Sean

> 
> 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-07-25 13:47 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 ` [PATCH 2/3] media: dvb-usb: move kfree(d) to dvb_usb_device_exit Dongliang Mu
2021-07-25 13:47   ` Sean Young [this message]
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=20210725134737.GA9696@gofer.mess.org \
    --to=sean@mess.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mudongliangabcd@gmail.com \
    /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.