From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============3341286297845330225==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: api: fix kobj_to_dev.cocci warnings Date: Tue, 15 Dec 2020 17:25:03 +0800 Message-ID: <20201215092503.GA12064@7554ba0207d6> In-Reply-To: <202012151756.gh6zd8hm-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============3341286297845330225== 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: Dan Williams CC: Vishal Verma CC: Dave Jiang CC: Ira Weiny CC: linux-nvdimm(a)lists.01.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/nvdimm/namespace_devs.c:1626: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 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: 148842c98a24e508aecb929718818fbf4c2a6ff3 commit: a2fc3718bc22e85378085568ecc5765fb28cabce coccinelle: api: add kobj_= to_dev.cocci script :::::: branch date: 6 hours ago :::::: commit date: 4 months ago Please take the patch only if it's a positive warning. Thanks! namespace_devs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/nvdimm/namespace_devs.c +++ b/drivers/nvdimm/namespace_devs.c @@ -1623,7 +1623,7 @@ static struct attribute *nd_namespace_at static umode_t namespace_visible(struct kobject *kobj, struct attribute *a, int n) { - struct device *dev =3D container_of(kobj, struct device, kobj); + struct device *dev =3D kobj_to_dev(kobj); = if (a =3D=3D &dev_attr_resource.attr && is_namespace_blk(dev)) return 0; --===============3341286297845330225==--