Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1321017

[PATCH 0/2] regulator: gpio: fix error paths in probe()

From Harald Geyer <harald@ccbib.org>
Newsgroups linux.kernel
Subject [PATCH 0/2] regulator: gpio: fix error paths in probe()
Date 2016-01-28 21:10 +0100
Message-ID <qW13b-a7-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View 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

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 0/2] regulator: gpio: fix error paths in probe() Harald Geyer <harald@ccbib.org> - 2016-01-28 21:10 +0100

csiph-web