CC: [email protected]
TO: Denis Efremov <[email protected]>
CC: Julia Lawall <[email protected]>
CC: Keith Busch <[email protected]>
CC: Jens Axboe <[email protected]>
CC: Christoph Hellwig <[email protected]>
CC: Sagi Grimberg <[email protected]>
CC: [email protected]
CC: [email protected]

From: kernel test robot <[email protected]>

drivers/nvme/host/core.c:3646:60-61: WARNING opportunity for kobj_to_dev()
drivers/nvme/host/core.c:3403:60-61: WARNING opportunity for kobj_to_dev()


 Use kobj_to_dev() instead of container_of()

Generated by: scripts/coccinelle/api/kobj_to_dev.cocci

Fixes: a2fc3718bc22 ("coccinelle: api: add kobj_to_dev.cocci script")
CC: Denis Efremov <[email protected]>
Signed-off-by: kernel test robot <[email protected]>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux.git 
for-5.10
head:   a2fc3718bc22e85378085568ecc5765fb28cabce
commit: a2fc3718bc22e85378085568ecc5765fb28cabce [3/3] coccinelle: api: add 
kobj_to_dev.cocci script
:::::: branch date: 5 days ago
:::::: commit date: 5 days ago

Please take the patch only if it's a positive warning. Thanks!

 core.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3400,7 +3400,7 @@ static struct attribute *nvme_ns_id_attr
 static umode_t nvme_ns_id_attrs_are_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 nvme_ns_ids *ids = &dev_to_ns_head(dev)->ids;
 
        if (a == &dev_attr_uuid.attr) {
@@ -3643,7 +3643,7 @@ static struct attribute *nvme_dev_attrs[
 static umode_t nvme_dev_attrs_are_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 nvme_ctrl *ctrl = dev_get_drvdata(dev);
 
        if (a == &dev_attr_delete_controller.attr && !ctrl->ops->delete_ctrl)
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to