linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Pramod Gurav <pramod.gurav.etc@gmail.com>
Cc: linux-input@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Pramod Gurav <pramod.gurav@smartplayin.com>,
	Guenter Roeck <linux@roeck-us.net>,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	Mark Brown <broonie@linaro.org>,
	Fabio Estevam <fabio.estevam@freescale.com>
Subject: Re: [PATCH] input: ads7846: Switch to managed version of kzalloc and cleanups
Date: Mon, 28 Jul 2014 10:31:54 -0700	[thread overview]
Message-ID: <20140728173154.GC8982@core.coreip.homeip.net> (raw)
In-Reply-To: <CAMf-jSmHpRLOOcmmW7qOPbwUv3oCtJMvFcqP2LVObE9qQL+D9g@mail.gmail.com>

On Mon, Jul 28, 2014 at 10:37:18PM +0530, Pramod Gurav wrote:
> Thanks Dmitry for reviewing.
> 
> On Mon, Jul 28, 2014 at 10:19 PM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> > Hi Pramod,
> >
> > On Mon, Jul 28, 2014 at 02:16:55PM +0530, pramod.gurav.etc@gmail.com wrote:
> >> From: Pramod Gurav <pramod.gurav@smartplayin.com>
> >>
> >> This switches memory allocations from kzalloc to devm_kzalloc.
> >> This also changes the way return checks were done on failure cases
> >> of three allocations. The checks were clubbed together and hence
> >> must be done seperately to avoid calling kfree on unallocated memory.
> >>
> >> Moreover in case of input_allocate_device failure, we were calling
> >> input_free_device which is not needed.
> >
> > But not hurting either - like kfree() and many other "cleanup" functions
> > in kernel they are happily accept NULL input (so that cleanup code is
> > less branchy).
> >>
> Great. Good to learn.
> >> input device must be released(input_free_device) when ads7846_probe_dt
> >> fails hence adds a fix there as well.
> >
> > That is the real bug, could you send me a patch that fixes just that (by
> > jumping to err_free_mem)?
> Sure I will.
> 
> >
> > The rest I'd like to leave as is unless you can convert _all_ resources
> > to be managed ones: mixing up 2 styles (manual and automatic release) is
> > bound to have issues (like we had with ads7846_probe_dt which assumed
> > that since it was releasing its resources automatically the rest would
> > be released automatically as well.
> 
> I thought I would use a managed input_device allocation in a separate patch.
> I will convert all allocations to managed then.
> 
> This driver also registers a irq. You suggest to convert it to managed as well?
> I was planning to do that?

Yes. And regulators, gpios, sysfs (you might need to have custom action
for that) and chip cleanup. OTOH I do not see much value in these
conversions unless they make the code much more clean.

Thanks,

-- 
Dmitry

      reply	other threads:[~2014-07-28 17:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-28  8:46 [PATCH] input: ads7846: Switch to managed version of kzalloc and cleanups pramod.gurav.etc
2014-07-28 16:49 ` Dmitry Torokhov
2014-07-28 17:07   ` Pramod Gurav
2014-07-28 17:31     ` Dmitry Torokhov [this message]

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=20140728173154.GC8982@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=broonie@linaro.org \
    --cc=fabio.estevam@freescale.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=paul.gortmaker@windriver.com \
    --cc=pramod.gurav.etc@gmail.com \
    --cc=pramod.gurav@smartplayin.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).