From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============8415496494477368389==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: api: fix kobj_to_dev.cocci warnings Date: Wed, 11 Nov 2020 17:50:09 +0800 Message-ID: <20201111095009.GA29738@0cc96b240cba> In-Reply-To: <202011111719.x1yA6Eo6-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============8415496494477368389== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org CC: linux-kernel(a)vger.kernel.org TO: Denis Efremov CC: Julia Lawall CC: Keith Busch CC: Jens Axboe CC: Christoph Hellwig CC: Sagi Grimberg CC: linux-nvme(a)lists.infradead.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/nvme/host/lightnvm.c:1244:60-61: WARNING opportunity for kobj_to_de= v() 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 Reported-by: kernel test robot Signed-off-by: kernel test robot --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git = master head: eccc876724927ff3b9ff91f36f7b6b159e948f0c commit: a2fc3718bc22e85378085568ecc5765fb28cabce coccinelle: api: add kobj_= to_dev.cocci script :::::: branch date: 15 hours ago :::::: commit date: 3 months ago Please take the patch only if it's a positive warning. Thanks! lightnvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/nvme/host/lightnvm.c +++ b/drivers/nvme/host/lightnvm.c @@ -1241,7 +1241,7 @@ static struct attribute *nvm_dev_attrs[] static umode_t nvm_dev_attrs_visible(struct kobject *kobj, struct attribute *attr, int index) { - struct device *dev =3D container_of(kobj, struct device, kobj); + struct device *dev =3D kobj_to_dev(kobj); struct gendisk *disk =3D dev_to_disk(dev); struct nvme_ns *ns =3D disk->private_data; struct nvm_dev *ndev =3D ns->ndev; --===============8415496494477368389==--