From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============8172687677900799707==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: api: fix kobj_to_dev.cocci warnings Date: Thu, 01 Apr 2021 04:25:59 +0800 Message-ID: <20210331202559.GA81382@423fe46d13f0> In-Reply-To: <202104010415.esDCLlNA-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============8172687677900799707== 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: Brian King CC: "James E.J. Bottomley" CC: "Martin K. Petersen" CC: linux-scsi(a)vger.kernel.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/scsi/ipr.c:4209:61-62: WARNING opportunity for kobj_to_dev() drivers/scsi/ipr.c:4185:61-62: WARNING opportunity for kobj_to_dev() drivers/scsi/ipr.c:4268:61-62: WARNING opportunity for kobj_to_dev() drivers/scsi/ipr.c:3459:60-61: WARNING opportunity for kobj_to_dev() drivers/scsi/ipr.c:4457: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 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: 5e46d1b78a03d52306f21f77a4e4a144b6d31486 commit: a2fc3718bc22e85378085568ecc5765fb28cabce coccinelle: api: add kobj_= to_dev.cocci script :::::: branch date: 23 hours ago :::::: commit date: 7 months ago Please take the patch only if it's a positive warning. Thanks! ipr.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -3456,7 +3456,7 @@ static ssize_t ipr_read_trace(struct fil struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count) { - struct device *dev =3D container_of(kobj, struct device, kobj); + struct device *dev =3D kobj_to_dev(kobj); struct Scsi_Host *shost =3D class_to_shost(dev); struct ipr_ioa_cfg *ioa_cfg =3D (struct ipr_ioa_cfg *)shost->hostdata; unsigned long lock_flags =3D 0; @@ -4182,7 +4182,7 @@ static ssize_t ipr_read_async_err_log(st struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count) { - struct device *cdev =3D container_of(kobj, struct device, kobj); + struct device *cdev =3D kobj_to_dev(kobj); struct Scsi_Host *shost =3D class_to_shost(cdev); struct ipr_ioa_cfg *ioa_cfg =3D (struct ipr_ioa_cfg *)shost->hostdata; struct ipr_hostrcb *hostrcb; @@ -4206,7 +4206,7 @@ static ssize_t ipr_next_async_err_log(st struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count) { - struct device *cdev =3D container_of(kobj, struct device, kobj); + struct device *cdev =3D kobj_to_dev(kobj); struct Scsi_Host *shost =3D class_to_shost(cdev); struct ipr_ioa_cfg *ioa_cfg =3D (struct ipr_ioa_cfg *)shost->hostdata; struct ipr_hostrcb *hostrcb; @@ -4265,7 +4265,7 @@ static ssize_t ipr_read_dump(struct file struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count) { - struct device *cdev =3D container_of(kobj, struct device, kobj); + struct device *cdev =3D kobj_to_dev(kobj); struct Scsi_Host *shost =3D class_to_shost(cdev); struct ipr_ioa_cfg *ioa_cfg =3D (struct ipr_ioa_cfg *)shost->hostdata; struct ipr_dump *dump; @@ -4454,7 +4454,7 @@ static ssize_t ipr_write_dump(struct fil struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count) { - struct device *cdev =3D container_of(kobj, struct device, kobj); + struct device *cdev =3D kobj_to_dev(kobj); struct Scsi_Host *shost =3D class_to_shost(cdev); struct ipr_ioa_cfg *ioa_cfg =3D (struct ipr_ioa_cfg *)shost->hostdata; int rc; --===============8172687677900799707==--