mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Harald Geyer <harald@ccbib.org>
To: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Heiko Stuebner <heiko@sntech.de>
Cc: linux-kernel@vger.kernel.org, Harald Geyer <harald@ccbib.org>
Subject: [PATCH 0/2] regulator: gpio: fix error paths in probe()
Date: Thu, 28 Jan 2016 19:55:16 +0000	[thread overview]
Message-ID: <1454010918-29369-1-git-send-email-harald@ccbib.org> (raw)

Currently resources aren't freed in the order in which they have been
allocated. Eg probe() frees drvdata->states even if it failed before
allocating that. I think allocating/copying the affacted data structures
isn't necessary anyway, so this is the easiest way to fix this.

Patch 1/2 is the actual fix.
Patch 2/2 is minor cleanup while looking at the code.

This series has only been compile tested yet. I will test it on
device-tree HW when I get access to my test equipment. I can't test
non-device-tree code however.

Other notes:
* This driver passes &drvdata->desc uninitialized (but zeroed) to
  of_get_gpio_regulator_config() - I don't know if this is ok.
* I'm not sure if copying config->supply_name is actually necessary,
  so I left that one in.

Harald Geyer (2):
  regulator: gpio: Avoid unnecessarily copying data structures in
    probe()
  regulator: gpio: Move last remaining memory allocation to devres

 drivers/regulator/gpio-regulator.c | 46 +++++++++-----------------------------
 1 file changed, 10 insertions(+), 36 deletions(-)

-- 
2.1.4

             reply	other threads:[~2016-01-28 20:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-28 19:55 Harald Geyer [this message]
2016-01-28 19:55 ` [PATCH 1/2] regulator: gpio: Avoid unnecessarily copying data structures " Harald Geyer
2016-01-28 23:09   ` Mark Brown
2016-01-29 16:25     ` Harald Geyer
2016-02-03 17:20       ` Mark Brown
2016-01-28 19:55 ` [PATCH 2/2] regulator: gpio: Move last remaining memory allocation to devres Harald Geyer

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=1454010918-29369-1-git-send-email-harald@ccbib.org \
    --to=harald@ccbib.org \
    --cc=broonie@kernel.org \
    --cc=heiko@sntech.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®