Whamcloud - gitweb
LU-16890 obd: OBD_FREE_PRE() to ignore NULL pointers 32/51332/7
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Thu, 15 Jun 2023 11:10:54 +0000 (16:40 +0530)
committerOleg Drokin <green@whamcloud.com>
Sat, 8 Jul 2023 22:36:32 +0000 (22:36 +0000)
commit46a9abf4330e7a12fde41fb922d6dfc4547c6243
treea83029fd0ef98e5d0842c678c51217301169e710
parent9190af53287b4921ae30fdf55a8f2a32983d8f0b
LU-16890 obd: OBD_FREE_PRE() to ignore NULL pointers

This patch modifies OBD_FREE_PRE() to not LASSERT
when null pointer is passed as the kfree() function
accepts NULL as no-op.

This is first set of patch that modifies the definitions.
Subsequent set will modify the callers to accept this
case.

As as example:

This caller will now be change to:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
char *test;
OBD_ALLOC(test, 32);
...
OBD_FREE(test, 32);

Previously the caller used to be:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
char *test;
OBD_ALLOC(test, 32);
...
if (test)
OBD_FREE(test, 32);

Test-Parameters: trivial
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: I735c8210e30f58da19ede4c87c07186108b35b99
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51332
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/obd_support.h