[PATCH] ndtest: use kobj_to_dev()

From: cgel . zte
Date: Mon Apr 25 2022 - 06:56:35 EST


From: Minghao Chi <chi.minghao@xxxxxxxxxx>

Use kobj_to_dev() instead of open-coding it.

Reported-by: Zeal Robot <zealci@xxxxxxxxxx>
Signed-off-by: Minghao Chi <chi.minghao@xxxxxxxxxx>
---
tools/testing/nvdimm/test/ndtest.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/nvdimm/test/ndtest.c b/tools/testing/nvdimm/test/ndtest.c
index 4d1a947367f9..b32ee76e0c17 100644
--- a/tools/testing/nvdimm/test/ndtest.c
+++ b/tools/testing/nvdimm/test/ndtest.c
@@ -725,7 +725,7 @@ static DEVICE_ATTR_RO(format1);
static umode_t ndtest_nvdimm_attr_visible(struct kobject *kobj,
struct attribute *a, int n)
{
- struct device *dev = container_of(kobj, struct device, kobj);
+ struct device *dev = kobj_to_dev(kobj);
struct nvdimm *nvdimm = to_nvdimm(dev);
struct ndtest_dimm *dimm = nvdimm_provider_data(nvdimm);

--
2.25.1