From: Greg KH <gregkh@linuxfoundation.org>
To: Matthew Giassa <matthew@giassa.net>
Cc: samuel@sortiz.org, devel@driverdev.osuosl.org,
georgiana.chelu93@gmail.com, johannes.berg@intel.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
davem@davemloft.net, khoroshilov@ispras.ru
Subject: Re: [PATCH] staging: irda: resolve sparse errors due to implicit pci_power_t casts
Date: Wed, 18 Oct 2017 16:12:16 +0200 [thread overview]
Message-ID: <20171018141216.GA6207@kroah.com> (raw)
In-Reply-To: <1507246703-1736-1-git-send-email-matthew@giassa.net>
On Thu, Oct 05, 2017 at 04:38:23PM -0700, Matthew Giassa wrote:
> Explicitly casting pci_power_t types to resolve sparse warnings (shown
> below).
>
> Also fixing a related logging bug where pci_power_t is cast to unsigned
> (can be negative, i.e. PCI_POWER_ERROR).
>
> Original sparse report:
>
> drivers/staging/irda/drivers//vlsi_ir.c:170:51: warning: cast from
> restricted pci_power_t
> drivers/staging/irda/drivers//vlsi_ir.c:1726:39: warning: restricted
> pci_power_t degrades to integer
> drivers/staging/irda/drivers//vlsi_ir.c:1728:45: warning: incorrect type
> in assignment (different base types)
> drivers/staging/irda/drivers//vlsi_ir.c:1728:45: expected restricted
> pci_power_t [usertype] current_state
> drivers/staging/irda/drivers//vlsi_ir.c:1728:45: got int [signed]
> [usertype] event
> drivers/staging/irda/drivers//vlsi_ir.c:1748:29: warning: incorrect type
> in assignment (different base types)
> drivers/staging/irda/drivers//vlsi_ir.c:1748:29: expected restricted
> pci_power_t [usertype] current_state
> drivers/staging/irda/drivers//vlsi_ir.c:1748:29: got int [signed]
> [usertype] event
Please do not line-wrap lines like this, it makes them harder to
understand.
>
> Warnings no longer present.
>
> Signed-off-by: Matthew Giassa <matthew@giassa.net>
> ---
> drivers/staging/irda/drivers/vlsi_ir.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/irda/drivers/vlsi_ir.c b/drivers/staging/irda/drivers/vlsi_ir.c
> index 3dff3c5..20ce4d8 100644
> --- a/drivers/staging/irda/drivers/vlsi_ir.c
> +++ b/drivers/staging/irda/drivers/vlsi_ir.c
> @@ -167,7 +167,8 @@ static void vlsi_proc_pdev(struct seq_file *seq, struct pci_dev *pdev)
>
> seq_printf(seq, "\n%s (vid/did: [%04x:%04x])\n",
> pci_name(pdev), (int)pdev->vendor, (int)pdev->device);
> - seq_printf(seq, "pci-power-state: %u\n", (unsigned) pdev->current_state);
> + seq_printf(seq, "pci-power-state: %d\n",
> + (int __force)pdev->current_state);
Ick, using __force is almost always a huge sign that something is wrong
here. This patch does not look correct because of this.
You did read drivers/staging/irda/TODO, right?
thanks,
greg k-h
next prev parent reply other threads:[~2017-10-18 14:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-05 23:38 [PATCH] staging: irda: resolve sparse errors due to implicit pci_power_t casts Matthew Giassa
2017-10-18 14:12 ` Greg KH [this message]
2017-10-24 12:56 ` Matthew Giassa
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=20171018141216.GA6207@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=davem@davemloft.net \
--cc=devel@driverdev.osuosl.org \
--cc=georgiana.chelu93@gmail.com \
--cc=johannes.berg@intel.com \
--cc=khoroshilov@ispras.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew@giassa.net \
--cc=netdev@vger.kernel.org \
--cc=samuel@sortiz.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.