linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.kw@hitachi.com>
To: Anton Vorontsov <anton@enomsg.org>,
	Colin Cross <ccross@android.com>,
	Kees Cook <keescook@chromium.org>,
	Tony Luck <tony.luck@intel.com>
Cc: linux-kernel@vger.kernel.org,
	Nobuhiro Iwamatsu <nobuhiro.iwamatsu.kw@hitachi.com>,
	Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>,
	Mark Salyzyn <salyzyn@android.com>,
	Seiji Aguchi <seiji.aguchi.tr@hitachi.com>,
	Shuah Khan <shuahkh@osg.samsung.com>
Subject: [PATCH v5 1/5] pstore: Change parameter of ramoops_free_przs()
Date: Mon, 27 Feb 2017 10:53:55 +0900	[thread overview]
Message-ID: <1488160439-7140-2-git-send-email-nobuhiro.iwamatsu.kw@hitachi.com> (raw)
In-Reply-To: <1488160439-7140-1-git-send-email-nobuhiro.iwamatsu.kw@hitachi.com>

This commit changes parameter of ramoops_free_przs() from
struct ramoops_context * into struct persistent_ram_zone * in order to
make it available for all prz array.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.kw@hitachi.com>
Signed-off-by: Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Mark Salyzyn <salyzyn@android.com>
Cc: Seiji Aguchi <seiji.aguchi.tr@hitachi.com>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Cc: Tony Luck <tony.luck@intel.com>

V5:
  - No chnages.

V4:
  - Rebase

V3:
 - Split patch.
 - Rebase.
---
 fs/pstore/ram.c | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 1d887efaaf71..8ad2d6d8cec2 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -508,26 +508,16 @@ static struct ramoops_context oops_cxt = {
 	},
 };
 
-static void ramoops_free_przs(struct ramoops_context *cxt)
+static void ramoops_free_przs(struct persistent_ram_zone **przs)
 {
 	int i;
 
-	/* Free dump PRZs */
-	if (cxt->dprzs) {
-		for (i = 0; i < cxt->max_dump_cnt; i++)
-			persistent_ram_free(cxt->dprzs[i]);
-
-		kfree(cxt->dprzs);
-		cxt->max_dump_cnt = 0;
-	}
+	if (!przs)
+		return;
 
-	/* Free ftrace PRZs */
-	if (cxt->fprzs) {
-		for (i = 0; i < cxt->max_ftrace_cnt; i++)
-			persistent_ram_free(cxt->fprzs[i]);
-		kfree(cxt->fprzs);
-		cxt->max_ftrace_cnt = 0;
-	}
+	for (i = 0; !IS_ERR_OR_NULL(przs[i]); i++)
+		persistent_ram_free(przs[i]);
+	kfree(przs);
 }
 
 static int ramoops_init_przs(const char *name,
@@ -863,10 +853,13 @@ static int ramoops_probe(struct platform_device *pdev)
 	cxt->pstore.bufsize = 0;
 	persistent_ram_free(cxt->mprz);
 fail_init_mprz:
+	cxt->max_ftrace_cnt = 0;
+	ramoops_free_przs(cxt->fprzs);
 fail_init_fprz:
 	persistent_ram_free(cxt->cprz);
 fail_init_cprz:
-	ramoops_free_przs(cxt);
+	cxt->max_dump_cnt = 0;
+	ramoops_free_przs(cxt->dprzs);
 fail_out:
 	return err;
 }
@@ -882,7 +875,13 @@ static int ramoops_remove(struct platform_device *pdev)
 
 	persistent_ram_free(cxt->mprz);
 	persistent_ram_free(cxt->cprz);
-	ramoops_free_przs(cxt);
+
+	/* Free ftrace PRZs */
+	cxt->max_ftrace_cnt = 0;
+	ramoops_free_przs(cxt->fprzs);
+	/* Free dump PRZs */
+	cxt->max_dump_cnt = 0;
+	ramoops_free_przs(cxt->dprzs);
 
 	return 0;
 }
-- 
2.11.0

  reply	other threads:[~2017-02-27  1:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-27  1:53 [PATCH v5 0/5] pstore: ramoops: support multiple pmsg instances Nobuhiro Iwamatsu
2017-02-27  1:53 ` Nobuhiro Iwamatsu [this message]
2017-02-27  1:53 ` [PATCH v5 2/5] ramoops: Add __ramoops_init_prz() as generic function Nobuhiro Iwamatsu
2017-02-27  1:53 ` [PATCH v5 3/5] pstore: support multiple pmsg instances Nobuhiro Iwamatsu
2017-02-27  1:53 ` [PATCH v5 4/5] ramoops: " Nobuhiro Iwamatsu
2017-02-27  1:53 ` [PATCH v5 5/5] selftests/pstore: add testcases for " Nobuhiro Iwamatsu
2018-11-29 23:33 ` [PATCH v5 0/5] pstore: ramoops: support " Kees Cook
2018-12-03  3:37   ` Nobuhiro Iwamatsu

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=1488160439-7140-2-git-send-email-nobuhiro.iwamatsu.kw@hitachi.com \
    --to=nobuhiro.iwamatsu.kw@hitachi.com \
    --cc=anton@enomsg.org \
    --cc=ccross@android.com \
    --cc=hiraku.toyooka.gu@hitachi.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=salyzyn@android.com \
    --cc=seiji.aguchi.tr@hitachi.com \
    --cc=shuahkh@osg.samsung.com \
    --cc=tony.luck@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).