From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752077AbdJXM4z (ORCPT ); Tue, 24 Oct 2017 08:56:55 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:43111 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751973AbdJXM4w (ORCPT ); Tue, 24 Oct 2017 08:56:52 -0400 X-Google-Smtp-Source: ABhQp+TC/hXCNQm3kZiMdRjl9wJwGmPfJs5KBATdAjSVjrgLAIgrclTvWEfkwhDcB0Zp9nfJ54NuMg== Date: Tue, 24 Oct 2017 05:56:49 -0700 From: Matthew Giassa To: Greg KH Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: irda: resolve sparse errors due to implicit pci_power_t casts Message-ID: <20171024125649.rexkewfxfkpnvqux@darkstar> References: <1507246703-1736-1-git-send-email-matthew@giassa.net> <20171018141216.GA6207@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20171018141216.GA6207@kroah.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Greg KH [2017-10-18 16:12:16 +0200]: >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. > Duly noted. >> >> Warnings no longer present. >> >> Signed-off-by: Matthew Giassa >> --- >> 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 Good point. This patch can be discarded. -Matthew