From: Dan Carpenter <dan.carpenter@oracle.com>
To: Daeseok Youn <daeseok.youn@gmail.com>
Cc: lidza.louina@gmail.com, gregkh@linuxfoundation.org,
markh@compro.net, driverdev-devel@linuxdriverproject.org,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V3] staging: dgap: implement error handling in dgap_tty_register()
Date: Mon, 19 May 2014 11:02:24 +0300 [thread overview]
Message-ID: <20140519080224.GL16255@mwanda> (raw)
In-Reply-To: <20140519021030.GA1051@devel.8.8.4.4>
Nice, but it needs a couple style improvements below.
On Mon, May 19, 2014 at 11:10:30AM +0900, Daeseok Youn wrote:
> + brd->dgap_major_serial_registered = TRUE;
> + dgap_boards_by_major[brd->serial_driver->major] = brd;
> + brd->dgap_serial_major = brd->serial_driver->major;
> +
> brd->dgap_major_transparent_print_registered = TRUE;
> dgap_boards_by_major[brd->print_driver->major] = brd;
> brd->dgap_transparent_print_major = brd->print_driver->major;
>
> return rc;
return 0;
> +
> +unregister_serial_drv:
> + tty_unregister_driver(brd->serial_driver);
> +free_print_ttys:
> + kfree(brd->print_driver->ttys);
> + brd->print_driver->ttys = NULL;
This label isn't needed. Just goto free_print_drv, because that will
free the brd->print_driver->ttys in destruct_tty_driver().
I do like how you noticed the double free and avoided it by setting
brd->serial_driver->ttys to NULL, so your patch doesn't introduce a
double free bug.
> +free_print_drv:
> + put_tty_driver(brd->print_driver);
> +free_serial_ttys:
> + kfree(brd->serial_driver->ttys);
> + brd->serial_driver->ttys = NULL;
Same for this.
> +free_serial_drv:
> + put_tty_driver(brd->serial_driver);
> +
> + return rc;
regards,
dan carpenter
next prev parent reply other threads:[~2014-05-19 8:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-19 2:10 [PATCH V3] staging: dgap: implement error handling in dgap_tty_register() Daeseok Youn
2014-05-19 8:02 ` Dan Carpenter [this message]
2014-05-19 9:39 ` DaeSeok Youn
2014-05-19 9:45 ` DaeSeok Youn
2014-05-19 8:06 ` Dan Carpenter
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=20140519080224.GL16255@mwanda \
--to=dan.carpenter@oracle.com \
--cc=daeseok.youn@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=driverdev-devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=lidza.louina@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markh@compro.net \
/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.