From 2174f6df7891fa331800beb72634c969f017900b Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Fri, 18 Nov 2011 13:49:00 -0800 Subject: pstore: gracefully handle NULL pstore_info functions If a pstore backend doesn't want to support various portions of the pstore interface, it can just leave those functions NULL instead of creating no-op stubs. Signed-off-by: Kees Cook Signed-off-by: Tony Luck --- fs/pstore/platform.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'fs/pstore/platform.c') diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index f146d89179bf..9ec22d3b4293 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -207,8 +207,7 @@ void pstore_get_records(int quiet) return; mutex_lock(&psi->read_mutex); - rc = psi->open(psi); - if (rc) + if (psi->open && psi->open(psi)) goto out; while ((size = psi->read(&id, &type, &time, &buf, psi)) > 0) { @@ -219,7 +218,8 @@ void pstore_get_records(int quiet) if (rc && (rc != -EEXIST || !quiet)) failed++; } - psi->close(psi); + if (psi->close) + psi->close(psi); out: mutex_unlock(&psi->read_mutex); -- cgit v1.2.3