lkml.org 
[lkml]   [2019]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 9/9] Input: add IOC3 serio driver
On Wed, 14 Aug 2019 15:20:14 +0200
Jonas Gorski <jonas.gorski@gmail.com> wrote:

> > + d = devm_kzalloc(&pdev->dev, sizeof(*d), GFP_KERNEL);
>
> &pdev->dev => dev

will change.

>
> > + if (!d)
> > + return -ENOMEM;
> > +
> > + sk = kzalloc(sizeof(*sk), GFP_KERNEL);
>
> any reason not to devm_kzalloc this as well? Then you won't need to
> manually free it in the error cases.

it has different life time than the device, so it may not allocated
via devm_kzalloc

> > +static int ioc3kbd_remove(struct platform_device *pdev)
> > +{
> > + struct ioc3kbd_data *d = platform_get_drvdata(pdev);
> > +
> > + devm_free_irq(&pdev->dev, d->irq, d);
> > + serio_unregister_port(d->kbd);
> > + serio_unregister_port(d->aux);
> > + return 0;
> > +}
>
> and on that topic, won't you need to kfree d->kbd and d->aux here?

that's done in serio_release_port() by the serio core.

Thomas.

--
SUSE Linux GmbH
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)

\
 
 \ /
  Last update: 2019-08-14 16:38    [W:0.066 / U:6.248 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site