Skip to content

Commit 5f11723

Browse files
lsgunthbjorn-helgaas
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: 52eabba ("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 b3a9e3b commit 5f11723

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/pci/switch/switchtec.c

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

942942
if (event_id < 0 || event_id >= SWITCHTEC_IOCTL_MAX_EVENTS)
943-
return ERR_PTR(-EINVAL);
943+
return (u32 __iomem *)ERR_PTR(-EINVAL);
944944

945945
off = event_regs[event_id].offset;
946946

947947
if (event_regs[event_id].map_reg == part_ev_reg) {
948948
if (index == SWITCHTEC_IOCTL_EVENT_LOCAL_PART_IDX)
949949
index = stdev->partition;
950950
else if (index < 0 || index >= stdev->partition_count)
951-
return ERR_PTR(-EINVAL);
951+
return (u32 __iomem *)ERR_PTR(-EINVAL);
952952
} else if (event_regs[event_id].map_reg == pff_ev_reg) {
953953
if (index < 0 || index >= stdev->pff_csr_count)
954-
return ERR_PTR(-EINVAL);
954+
return (u32 __iomem *)ERR_PTR(-EINVAL);
955955
}
956956

957957
return event_regs[event_id].map_reg(stdev, off, index);
@@ -1057,11 +1057,11 @@ static int ioctl_event_ctl(struct switchtec_dev *stdev,
10571057
}
10581058

10591059
static int ioctl_pff_to_port(struct switchtec_dev *stdev,
1060-
struct switchtec_ioctl_pff_port *up)
1060+
struct switchtec_ioctl_pff_port __user *up)
10611061
{
10621062
int i, part;
10631063
u32 reg;
1064-
struct part_cfg_regs *pcfg;
1064+
struct part_cfg_regs __iomem *pcfg;
10651065
struct switchtec_ioctl_pff_port p;
10661066

10671067
if (copy_from_user(&p, up, sizeof(p)))
@@ -1104,10 +1104,10 @@ static int ioctl_pff_to_port(struct switchtec_dev *stdev,
11041104
}
11051105

11061106
static int ioctl_port_to_pff(struct switchtec_dev *stdev,
1107-
struct switchtec_ioctl_pff_port *up)
1107+
struct switchtec_ioctl_pff_port __user *up)
11081108
{
11091109
struct switchtec_ioctl_pff_port p;
1110-
struct part_cfg_regs *pcfg;
1110+
struct part_cfg_regs __iomem *pcfg;
11111111

11121112
if (copy_from_user(&p, up, sizeof(p)))
11131113
return -EFAULT;

0 commit comments

Comments
 (0)