Skip to contentSkip to conversation

ndtest: Switch to using the new API kobj_to_dev()

PATCH New Yang Li 1 participant 1 message Feb 22, 2021 libnvdimm: non-volatile memory device

lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 ndtest: Switch to using the new API kobj_to_dev()

fixed the following coccicheck:
./tools/testing/nvdimm/test/ndtest.c:785:60-61: WARNING opportunity for kobj_to_dev()

---
 tools/testing/nvdimm/test/ndtest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/nvdimm/test/ndtest.c +1 -1
index 6862915..004a36f 100644
@@ -782,7 +782,7 @@ static ssize_t format1_show(struct device *dev, struct device_attribute *attr,
 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);
 
Signature · 4 lines
1.8.3.1
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]