PCI/switechtec: Add missing __iomem and __user tags to fix sparse warnings
Subsystems (2)
Logan Gunthorpe
maintainerPATCH 1/2 PCI/switechtec: Add missing __iomem and __user tags to fix sparse warnings
Fix a number of missing __iomem and __user tags in the ioctl functions of the switchtec driver. This fixes a number of sparse warnings of the form:
sparse: sparse: incorrect type in ... (different address spaces)
---
Here are a couple quick patches to fix some sparse warnings I was notified about a couple weeks ago.
I've split them into two patches based on Fixes tag, but they could be squashed depending on the preference.
Thanks!
drivers/pci/switch/switchtec.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
drivers/pci/switch/switchtec.c +7 -7
@@ -940,7 +940,7 @@ static u32 __iomem *event_hdr_addr(struct switchtec_dev *stdev,size_t off;if (event_id <0 || event_id >=SWITCHTEC_IOCTL_MAX_EVENTS ) -return ERR_PTR (-EINVAL ); +return (u32 __iomem *)ERR_PTR (-EINVAL ); off = event_regs[event_id].offset;
@@ -948,10 +948,10 @@ static u32 __iomem *event_hdr_addr(struct switchtec_dev *stdev,if (index ==SWITCHTEC_IOCTL_EVENT_LOCAL_PART_IDX ) index = stdev->partition;else if (index <0 || index >= stdev->partition_count) -return ERR_PTR (-EINVAL ); +return (u32 __iomem *)ERR_PTR (-EINVAL ); }else if (event_regs[event_id].map_reg == pff_ev_reg) {if (index <0 || index >= stdev->pff_csr_count) -return ERR_PTR (-EINVAL ); +return (u32 __iomem *)ERR_PTR (-EINVAL ); }return event_regs[event_id].map_reg (stdev, off, index);
@@ -1057,11 +1057,11 @@ static int ioctl_event_ctl(struct switchtec_dev *stdev, }static int ioctl_pff_to_port (struct switchtec_dev *stdev, -struct switchtec_ioctl_pff_port *up) +struct switchtec_ioctl_pff_port __user *up) {int i, part;u32 reg; -struct part_cfg_regs *pcfg; +struct part_cfg_regs __iomem *pcfg;struct switchtec_ioctl_pff_port p;if (copy_from_user (&p, up,sizeof (p)))
@@ -1104,10 +1104,10 @@ static int ioctl_pff_to_port(struct switchtec_dev *stdev, }static int ioctl_port_to_pff (struct switchtec_dev *stdev, -struct switchtec_ioctl_pff_port *up) +struct switchtec_ioctl_pff_port __user *up) {struct switchtec_ioctl_pff_port p; -struct part_cfg_regs *pcfg; +struct part_cfg_regs __iomem *pcfg;if (copy_from_user (&p, up,sizeof (p)))return -EFAULT ;
base-commit: 92ed301919932f777713b9172e525674157e983d --
2.20.1
Logan Gunthorpe
maintainerPATCH 2/2 PCI/switechtec: Add missing __iomem tag to fix sparse warnings
Fix a missing __iomem tag in the init_pfn() function. This fixes a sparse warning of the form:
sparse: sparse: incorrect type assignment(different address spaces)
--- drivers/pci/switch/switchtec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/switch/switchtec.c +1 -1
@@ -1484,7 +1484,7 @@ static void init_pff(struct switchtec_dev *stdev) {int i;u32 reg; -struct part_cfg_regs *pcfg = stdev->mmio_part_cfg; +struct part_cfg_regs __iomem *pcfg = stdev->mmio_part_cfg;for (i =0 ; i <SWITCHTEC_MAX_PFF_CSR ; i++) { reg =ioread16 (&stdev->mmio_pff_csr[i].vendor_id);
Signature · 1 line
2.20.1
Bjorn Helgaas
AppliedQuoted 7 lines · Logan Gunthorpe
Fix a number of missing
__iomemand__usertags in the ioctl functions of the switchtec driver. This fixes a number of sparse warnings of the form:sparse: sparse: incorrect type in ... (different address spaces)
Fixes 52eabba5bcdb ("switchtec: Add IOCTLs to the Switchtec driver")Signed-off-by Logan Gunthorpe <[email protected]>
Applied to pci/switchtec for v5.9, thanks!
Quoted 70 lines
---
Here are a couple quick patches to fix some sparse warnings I was notified about a couple weeks ago.
I've split them into two patches based on Fixes tag, but they could be squashed depending on the preference.
Thanks!
drivers/pci/switch/switchtec.c| 14 +++++++-------1 file changed, 7 insertions(+), 7 deletions(-)drivers/pci/switch/switchtec.c +7
-7@@ -940,7 +940,7 @@ static u32 __iomem *event_hdr_addr(struct switchtec_dev *stdev,size_t off;if (event_id <0 || event_id >=SWITCHTEC_IOCTL_MAX_EVENTS ) -return ERR_PTR (-EINVAL ); +return (u32 __iomem *)ERR_PTR (-EINVAL ); off = event_regs[event_id].offset;@@ -948,10 +948,10 @@ static u32 __iomem *event_hdr_addr(struct switchtec_dev *stdev,if (index ==SWITCHTEC_IOCTL_EVENT_LOCAL_PART_IDX ) index = stdev->partition;else if (index <0 || index >= stdev->partition_count) -return ERR_PTR (-EINVAL ); +return (u32 __iomem *)ERR_PTR (-EINVAL ); }else if (event_regs[event_id].map_reg == pff_ev_reg) {if (index <0 || index >= stdev->pff_csr_count) -return ERR_PTR (-EINVAL ); +return (u32 __iomem *)ERR_PTR (-EINVAL ); }return event_regs[event_id].map_reg (stdev, off, index);@@ -1057,11 +1057,11 @@ static int ioctl_event_ctl(struct switchtec_dev *stdev, }static int ioctl_pff_to_port (struct switchtec_dev *stdev, -struct switchtec_ioctl_pff_port *up) +struct switchtec_ioctl_pff_port __user *up) {int i, part;u32 reg; -struct part_cfg_regs *pcfg; +struct part_cfg_regs __iomem *pcfg;struct switchtec_ioctl_pff_port p;if (copy_from_user (&p, up,sizeof (p)))@@ -1104,10 +1104,10 @@ static int ioctl_pff_to_port(struct switchtec_dev *stdev, }static int ioctl_port_to_pff (struct switchtec_dev *stdev, -struct switchtec_ioctl_pff_port *up) +struct switchtec_ioctl_pff_port __user *up) {struct switchtec_ioctl_pff_port p; -struct part_cfg_regs *pcfg; +struct part_cfg_regs __iomem *pcfg;if (copy_from_user (&p, up,sizeof (p)))return -EFAULT ;base-commit:
92ed301919932f777713b9172e525674157e983d--
2.20.1