linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: rui.zhang@intel.com, edubezval@gmail.com
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org,
	Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Subject: [PATCH 0/3 v2] thermal: core: Fix some error handling code in 'thermal_zone_device_register()'
Date: Tue,  8 Aug 2017 16:39:51 +0200	[thread overview]
Message-ID: <cover.1502201798.git.christophe.jaillet@wanadoo.fr> (raw)

These patches fix some issue in the error handling path in
'thermal_zone_device_register()'

The first patch adds some new helper function in order to ease the resource
management.
Maybe using devm_ variant could also be a better choise to free manage
these resources. As it would be a bigger change, I've not looked at it at
all at the moment.
Also, note that this patch triggers a checkpatch warning about missing
identifier name in function definition. I've left it as is to keep the
style of the .h file.

The 2nd patch makes use of the new helper function.

The 3rd patch reorders the error handling path of
'thermal_zone_device_register()' in order to avoid the leaks.

*** These patches have been compiled tested only. ***

I also unsure about the right place for 'ida_simple_remove' in patch 3/3.


v1 -> v2:
    - add some helper functions in order to release some resources more
      easily
    - split the error handling path into 2. One before a successful call to
      'device_register()', and one after


Christophe JAILLET (3):
  thermal: core: Add some new helper functions to free resources
  thermal: core: Use the new 'thermal_zone_destroy_device_groups()'
    helper function
  thermal: core: Fix resources release in error paths in
    thermal_zone_device_register()

 drivers/thermal/thermal_core.c  | 29 ++++++++++++++---------------
 drivers/thermal/thermal_core.h  |  1 +
 drivers/thermal/thermal_sysfs.c | 29 +++++++++++++++++++++++++++++
 3 files changed, 44 insertions(+), 15 deletions(-)

-- 
2.11.0

             reply	other threads:[~2017-08-08 14:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-08 14:39 Christophe JAILLET [this message]
2017-08-08 14:39 ` [PATCH 1/3 v2] thermal: core: Add some new helper functions to free resources Christophe JAILLET
2017-08-11  3:23   ` Zhang Rui
2017-08-11  3:31     ` Zhang Rui
2017-08-11  7:30   ` walter harms
2017-08-11  8:20     ` Zhang Rui
2017-08-08 14:39 ` [PATCH 2/3 v2] thermal: core: Use the new 'thermal_zone_destroy_device_groups()' helper function Christophe JAILLET
2017-08-08 14:39 ` [PATCH 3/3 v2] thermal: core: Fix resources release in error paths in thermal_zone_device_register() Christophe JAILLET

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=cover.1502201798.git.christophe.jaillet@wanadoo.fr \
    --to=christophe.jaillet@wanadoo.fr \
    --cc=edubezval@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.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).