From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============6557483936414565584==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: api: fix kobj_to_dev.cocci warnings Date: Sun, 20 Dec 2020 19:36:49 +0800 Message-ID: <20201220113649.GA43068@e33b67272a7c> In-Reply-To: <202012201908.Fjs2GOZ6-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============6557483936414565584== 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: Lee Jones CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/mfd/lm3533-core.c:361: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: 467f8165a2b0e6accf3d0dd9c8089b1dbde29f7f commit: a2fc3718bc22e85378085568ecc5765fb28cabce coccinelle: api: add kobj_= to_dev.cocci script :::::: branch date: 15 hours ago :::::: commit date: 4 months ago Please take the patch only if it's a positive warning. Thanks! lm3533-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mfd/lm3533-core.c +++ b/drivers/mfd/lm3533-core.c @@ -358,7 +358,7 @@ static struct attribute *lm3533_attribut static umode_t lm3533_attr_is_visible(struct kobject *kobj, struct attribute *attr, int n) { - struct device *dev =3D container_of(kobj, struct device, kobj); + struct device *dev =3D kobj_to_dev(kobj); struct lm3533 *lm3533 =3D dev_get_drvdata(dev); struct device_attribute *dattr =3D to_dev_attr(attr); struct lm3533_device_attribute *lattr =3D to_lm3533_dev_attr(dattr); --===============6557483936414565584==--