linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Agner <stefan@agner.ch>
To: linus.walleij@linaro.org
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Stefan Agner <stefan@agner.ch>
Subject: [PATCH] pinctrl: core: do not explicitly free on unregister
Date: Mon, 15 May 2017 23:18:59 -0700	[thread overview]
Message-ID: <20170516061859.396-1-stefan@agner.ch> (raw)

When using the resource managed version of pinctrl, resources
might already been freed when pinctrl_unregister is called by the
devres framework. When calling devm_kfree on such a already freed
resource, devres prints a warning:
  WARNING: CPU: 0 PID: 1 at drivers/base/devres.c:891 pinmux_generic_free_functions+0xf4/0x128
  ...

Solve this by not explicitly free resources. The two affected
functions (pinmux_generic_free_functions/pinctrl_generic_free_groups)
are only used in pinctrl_unregister. When not using the resource
managed version of pinctrl, the underlying device will presumably
get freed freed soon anyway.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 drivers/pinctrl/core.c   | 1 -
 drivers/pinctrl/pinmux.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 1653cbda6a82..bc4c12008cd4 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -702,7 +702,6 @@ static void pinctrl_generic_free_groups(struct pinctrl_dev *pctldev)
 		group = radix_tree_lookup(&pctldev->pin_group_tree,
 					  indices[i]);
 		radix_tree_delete(&pctldev->pin_group_tree, indices[i]);
-		devm_kfree(pctldev->dev, group);
 	}
 
 	pctldev->num_groups = 0;
diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
index 9fd6d9087dc5..87098be84a3c 100644
--- a/drivers/pinctrl/pinmux.c
+++ b/drivers/pinctrl/pinmux.c
@@ -848,7 +848,6 @@ void pinmux_generic_free_functions(struct pinctrl_dev *pctldev)
 		function = radix_tree_lookup(&pctldev->pin_function_tree,
 					     indices[i]);
 		radix_tree_delete(&pctldev->pin_function_tree, indices[i]);
-		devm_kfree(pctldev->dev, function);
 	}
 
 	pctldev->num_functions = 0;
-- 
2.13.0


             reply	other threads:[~2017-05-16  6:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-16  6:18 Stefan Agner [this message]
2017-05-23  8:20 ` [PATCH] pinctrl: core: do not explicitly free on unregister Linus Walleij

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=20170516061859.396-1-stefan@agner.ch \
    --to=stefan@agner.ch \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).