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 <keescook@chromium.org>
Signed-off-by: Tony Luck <tony.luck@intel.com>
 {
        struct pstore_private *p = dentry->d_inode->i_private;
 
-       p->psi->erase(p->type, p->id, p->psi);
+       if (p->psi->erase)
+               p->psi->erase(p->type, p->id, p->psi);
 
        return simple_unlink(dir, dentry);
 }
 
                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) {
                if (rc && (rc != -EEXIST || !quiet))
                        failed++;
        }
-       psi->close(psi);
+       if (psi->close)
+               psi->close(psi);
 out:
        mutex_unlock(&psi->read_mutex);