Skip to content

Commit 4279d99

Browse files
lsgunthkelvin-cao
authored andcommitted
PCI: switchtec: 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: $ make C=2 drivers/pci/switch/ drivers/pci/switch/switchtec.c:... incorrect type in ... (different address spaces) Fixes: 52eabba5bcdb ("switchtec: Add IOCTLs to the Switchtec driver") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Logan Gunthorpe <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent eb717db commit 4279d99

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

switchtec.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -993,18 +993,18 @@ static u32 __iomem *event_hdr_addr(struct switchtec_dev *stdev,
993993
size_t off;
994994

995995
if (event_id < 0 || event_id >= SWITCHTEC_IOCTL_MAX_EVENTS)
996-
return ERR_PTR(-EINVAL);
996+
return (u32 __iomem *)ERR_PTR(-EINVAL);
997997

998998
off = event_regs[event_id].offset;
999999

10001000
if (event_regs[event_id].map_reg == part_ev_reg) {
10011001
if (index == SWITCHTEC_IOCTL_EVENT_LOCAL_PART_IDX)
10021002
index = stdev->partition;
10031003
else if (index < 0 || index >= stdev->partition_count)
1004-
return ERR_PTR(-EINVAL);
1004+
return (u32 __iomem *)ERR_PTR(-EINVAL);
10051005
} else if (event_regs[event_id].map_reg == pff_ev_reg) {
10061006
if (index < 0 || index >= stdev->pff_csr_count)
1007-
return ERR_PTR(-EINVAL);
1007+
return (u32 __iomem *)ERR_PTR(-EINVAL);
10081008
}
10091009

10101010
return event_regs[event_id].map_reg(stdev, off, index);
@@ -1113,11 +1113,11 @@ static int ioctl_event_ctl(struct switchtec_dev *stdev,
11131113
}
11141114

11151115
static int ioctl_pff_to_port(struct switchtec_dev *stdev,
1116-
struct switchtec_ioctl_pff_port *up)
1116+
struct switchtec_ioctl_pff_port __user *up)
11171117
{
11181118
int i, part;
11191119
u32 reg;
1120-
struct part_cfg_regs *pcfg;
1120+
struct part_cfg_regs __iomem *pcfg;
11211121
struct switchtec_ioctl_pff_port p;
11221122

11231123
if (copy_from_user(&p, up, sizeof(p)))
@@ -1160,10 +1160,10 @@ static int ioctl_pff_to_port(struct switchtec_dev *stdev,
11601160
}
11611161

11621162
static int ioctl_port_to_pff(struct switchtec_dev *stdev,
1163-
struct switchtec_ioctl_pff_port *up)
1163+
struct switchtec_ioctl_pff_port __user *up)
11641164
{
11651165
struct switchtec_ioctl_pff_port p;
1166-
struct part_cfg_regs *pcfg;
1166+
struct part_cfg_regs __iomem *pcfg;
11671167

11681168
if (copy_from_user(&p, up, sizeof(p)))
11691169
return -EFAULT;

0 commit comments

Comments
 (0)