All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: linux-nvdimm@lists.01.org
Cc: Tiffany Kasanicky <tiffany.j.kasanicky@intel.com>
Subject: [ndctl PATCH] ndctl: permit NULL as a parameter to ndctl_cmd_unref
Date: Tue, 19 Jul 2016 16:00:09 -0700	[thread overview]
Message-ID: <146896920956.18759.7000784801515467749.stgit@dwillia2-desk3.amr.corp.intel.com> (raw)

Similar to libc free() allow NULL as a valid parameter to this freeing
routine.  This mirrors the behavior of the other *_unref() routines in
the library.

Cc: Tiffany Kasanicky <tiffany.j.kasanicky@intel.com>
Reported-by: Linda Knippers <linda.knippers@hpe.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 ndctl/lib/libndctl.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index 0722f79470c3..4b1247678a08 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -2122,6 +2122,8 @@ NDCTL_EXPORT int ndctl_dimm_zero_labels(struct ndctl_dimm *dimm)
 
 NDCTL_EXPORT void ndctl_cmd_unref(struct ndctl_cmd *cmd)
 {
+	if (!cmd)
+		return;
 	if (--cmd->refcount == 0) {
 		if (cmd->source)
 			ndctl_cmd_unref(cmd->source);

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

             reply	other threads:[~2016-07-19 23:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-19 23:00 Dan Williams [this message]
2016-07-20  7:56 ` [ndctl PATCH] ndctl: permit NULL as a parameter to ndctl_cmd_unref Johannes Thumshirn

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=146896920956.18759.7000784801515467749.stgit@dwillia2-desk3.amr.corp.intel.com \
    --to=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    --cc=tiffany.j.kasanicky@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.