libnvdimm/of_pmem: Use devm_kstrdup instead of kstrdup and check its return value
authorChen Ni <nichen@iscas.ac.cn>
Thu, 14 Sep 2023 07:03:27 +0000 (07:03 +0000)
committerIra Weiny <ira.weiny@intel.com>
Wed, 27 Sep 2023 17:33:47 +0000 (10:33 -0700)
commit6fd4ebfc4d61e3097b595ab2725d513e3bbd6739
treeb44459d619f6c6722bf61d98a5a739319bb830d7
parent75b3d5dc0846cfa54ea52d7d84215b761ecbf569
libnvdimm/of_pmem: Use devm_kstrdup instead of kstrdup and check its return value

Use devm_kstrdup() instead of kstrdup() and check its return value to
avoid memory leak.

Fixes: 49bddc73d15c ("libnvdimm/of_pmem: Provide a unique name for bus provider")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
drivers/nvdimm/of_pmem.c