CC: [email protected]
TO: Denis Efremov <[email protected]>
CC: Julia Lawall <[email protected]>
CC: "James E.J. Bottomley" <[email protected]>
CC: "Martin K. Petersen" <[email protected]>
CC: [email protected]
CC: [email protected]

From: kernel test robot <[email protected]>

drivers/scsi/scsi_transport_spi.c:1460:61-62: 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!

 scsi_transport_spi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -1457,7 +1457,7 @@ static int spi_host_configure(struct tra
 static umode_t target_attribute_is_visible(struct kobject *kobj,
                                          struct attribute *attr, int i)
 {
-       struct device *cdev = container_of(kobj, struct device, kobj);
+       struct device *cdev = kobj_to_dev(kobj);
        struct scsi_target *starget = transport_class_to_starget(cdev);
        struct Scsi_Host *shost = transport_class_to_shost(cdev);
        struct spi_internal *si = to_spi_internal(shost->transportt);
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to