Message ID | 20220303231657.1053594-1-alison.schofield@intel.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 4b381a31345930d08ab9adb87087bb765f624506 |
Headers | show |
Series | [ndctl] libcxl: Remove extraneous NULL checks when validating cmd status | expand |
On Thu, Mar 3, 2022 at 3:13 PM <alison.schofield@intel.com> wrote: > > From: Alison Schofield <alison.schofield@intel.com> > > When a cxl_cmd_new_*() function is executed the returned command > pointer is always checked for NULL. Remove extraneous NULL checks > later in the command validation path. > > Coverity pointed these out as 'check_after_deref' issues. > > Signed-off-by: Alison Schofield <alison.schofield@intel.com> LGTM: Reviewed-by: Dan Williams <dan.j.williams@intel.com>
diff --git a/cxl/lib/libcxl.c b/cxl/lib/libcxl.c index daa2bbc5a299..f111d8681669 100644 --- a/cxl/lib/libcxl.c +++ b/cxl/lib/libcxl.c @@ -2283,8 +2283,6 @@ cmd_to_identify(struct cxl_cmd *cmd) if (cxl_cmd_validate_status(cmd, CXL_MEM_COMMAND_ID_IDENTIFY)) return NULL; - if (!cmd) - return NULL; return cmd->output_payload; } @@ -2429,8 +2427,6 @@ cmd_to_get_partition(struct cxl_cmd *cmd) if (cxl_cmd_validate_status(cmd, CXL_MEM_COMMAND_ID_GET_PARTITION_INFO)) return NULL; - if (!cmd) - return NULL; return cmd->output_payload; }