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: 52eabba5bc
("switchtec: Add IOCTLs to the Switchtec driver")
Link: https://lore.kernel.org/r/20200728192434.18993-1-logang@deltatee.com
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
parent
b3a9e3b962
commit
5f11723b20
@ -940,7 +940,7 @@ static u32 __iomem *event_hdr_addr(struct switchtec_dev *stdev,
|
|||||||
size_t off;
|
size_t off;
|
||||||
|
|
||||||
if (event_id < 0 || event_id >= SWITCHTEC_IOCTL_MAX_EVENTS)
|
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;
|
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)
|
if (index == SWITCHTEC_IOCTL_EVENT_LOCAL_PART_IDX)
|
||||||
index = stdev->partition;
|
index = stdev->partition;
|
||||||
else if (index < 0 || index >= stdev->partition_count)
|
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) {
|
} else if (event_regs[event_id].map_reg == pff_ev_reg) {
|
||||||
if (index < 0 || index >= stdev->pff_csr_count)
|
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);
|
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,
|
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;
|
int i, part;
|
||||||
u32 reg;
|
u32 reg;
|
||||||
struct part_cfg_regs *pcfg;
|
struct part_cfg_regs __iomem *pcfg;
|
||||||
struct switchtec_ioctl_pff_port p;
|
struct switchtec_ioctl_pff_port p;
|
||||||
|
|
||||||
if (copy_from_user(&p, up, sizeof(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,
|
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 switchtec_ioctl_pff_port p;
|
||||||
struct part_cfg_regs *pcfg;
|
struct part_cfg_regs __iomem *pcfg;
|
||||||
|
|
||||||
if (copy_from_user(&p, up, sizeof(p)))
|
if (copy_from_user(&p, up, sizeof(p)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
Loading…
Reference in New Issue
Block a user