]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
nvdimm: rectify the illogical code within nd_dax_probe()
authorYi Yang <yiyang13@huawei.com>
Fri, 8 Nov 2024 08:55:26 +0000 (08:55 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 18:51:41 +0000 (19:51 +0100)
commitc710201af655f859b7842a63d850a4b4d78c7d6d
tree16a9558a982ce61b76367a6d2b8daf3bb812b130
parentff11b66cf848893e07afed6f53b67d0e1a9c034a
nvdimm: rectify the illogical code within nd_dax_probe()

[ Upstream commit b61352101470f8b68c98af674e187cfaa7c43504 ]

When nd_dax is NULL, nd_pfn is consequently NULL as well. Nevertheless,
it is inadvisable to perform pointer arithmetic or address-taking on a
NULL pointer.
Introduce the nd_dax_devinit() function to enhance the code's logic and
improve its readability.

Signed-off-by: Yi Yang <yiyang13@huawei.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Link: https://patch.msgid.link/20241108085526.527957-1-yiyang13@huawei.com
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvdimm/dax_devs.c
drivers/nvdimm/nd.h