Skip to content

Commit a18ac31

Browse files
JuliaLawallgregkh
authored andcommitted
staging: lustre: lnet: lnet: fix error return code
Return a negative error code on failure. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ identifier ret; expression e1,e2; @@ ( if (\(ret < 0\|ret != 0\)) { ... return ret; } | ret = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // </smpl> Signed-off-by: Julia Lawall <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b183c11 commit a18ac31

File tree

1 file changed

+6
-2
lines changed
  • drivers/staging/lustre/lnet/lnet

1 file changed

+6
-2
lines changed

drivers/staging/lustre/lnet/lnet/api-ni.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -650,15 +650,19 @@ lnet_prepare(lnet_pid_t requested_pid)
650650

651651
recs = lnet_res_containers_create(LNET_COOKIE_TYPE_ME, LNET_FL_MAX_MES,
652652
sizeof(lnet_me_t));
653-
if (recs == NULL)
653+
if (recs == NULL) {
654+
rc = -ENOMEM;
654655
goto failed;
656+
}
655657

656658
the_lnet.ln_me_containers = recs;
657659

658660
recs = lnet_res_containers_create(LNET_COOKIE_TYPE_MD, LNET_FL_MAX_MDS,
659661
sizeof(lnet_libmd_t));
660-
if (recs == NULL)
662+
if (recs == NULL) {
663+
rc = -ENOMEM;
661664
goto failed;
665+
}
662666

663667
the_lnet.ln_md_containers = recs;
664668

0 commit comments

Comments
 (0)