Linux-PCI Archive on lore.kernel.org
 help / color / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Logan Gunthorpe <logang@deltatee.com>
Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	Bjorn Helgaas <bhelgaas@google.com>,
	Kelvin.Cao@microchip.com
Subject: Re: [PATCH 1/2] PCI/switechtec: Add missing __iomem and __user tags to fix sparse warnings
Date: Wed, 29 Jul 2020 14:35:04 -0500
Message-ID: <20200729193504.GA1960928@bjorn-Precision-5520> (raw)
In-Reply-To: <20200728192434.18993-1-logang@deltatee.com>

On Tue, Jul 28, 2020 at 01:24:33PM -0600, Logan Gunthorpe wrote:
> 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)
> 
> Fixes: 52eabba5bcdb ("switchtec: Add IOCTLs to the Switchtec driver")
> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>

Applied to pci/switchtec for v5.9, thanks!

> ---
> 
> 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(-)
> 
> diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
> index 850cfeb74608..3d5da7f44378 100644
> --- a/drivers/pci/switch/switchtec.c
> +++ b/drivers/pci/switch/switchtec.c
> @@ -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

      parent reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-28 19:24 Logan Gunthorpe
2020-07-28 19:24 ` [PATCH 2/2] PCI/switechtec: Add missing __iomem tag " Logan Gunthorpe
2020-07-29 19:35 ` Bjorn Helgaas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200729193504.GA1960928@bjorn-Precision-5520 \
    --to=helgaas@kernel.org \
    --cc=Kelvin.Cao@microchip.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=logang@deltatee.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-PCI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-pci/0 linux-pci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-pci linux-pci/ https://lore.kernel.org/linux-pci \
		linux-pci@vger.kernel.org
	public-inbox-index linux-pci

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-pci


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git