Re: [PATCH v2] staging: vt6655: fix sparse warning for static declaration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 08, 2014 at 06:53:02AM -0700, Greg Kroah-Hartman wrote:
> On Thu, Oct 09, 2014 at 12:17:06AM +1100, Vladimir A. Nazarenko wrote:
> > This patch fixes the following sparse warning:
> > drivers/staging/vt6655/ioctl.c:44:12: warning: symbol 'wpa_Result'
> > 	was not declared. Should it be static?
> > 
> > There is no sense to set up all fields of wpa_Result to zero when
> > interface set up (in device_open()), because wpa_Result is used
> > only in code for ioctl 0xff and first lines of this ioctl do the
> > same work. So this patch deletes part of unneeded code
> > (initialization of wpa_Result to zero in device_open()) and
> > declares wpa_Reslult as static to avoid sparse warning.
> > 
> > Signed-off-by: Vladimir A. Nazarenko <naszar@xxxxx>
> > ---
> >  drivers/staging/vt6655/device_main.c | 8 --------
> >  drivers/staging/vt6655/ioctl.c       | 2 +-
> >  2 files changed, 1 insertion(+), 9 deletions(-)
> > 
> > diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
> > index 54e16f4..de5378e 100644
> > --- a/drivers/staging/vt6655/device_main.c
> > +++ b/drivers/staging/vt6655/device_main.c
> > @@ -1553,9 +1553,6 @@ static int  device_open(struct net_device *dev)
> >  {
> >  	struct vnt_private *pDevice = netdev_priv(dev);
> >  	int i;
> > -#ifdef WPA_SM_Transtatus
> 
> Is this defined by the build system?  If not, just delete all the code
> in the driver that is #ifdef by it please.
> 
> If it is enabled, then I think you just changed the logic of the code
> here :(

It's enabled.  The patch doesn't break anything.  But really it should
probably delete some more code as well.

diff --git a/drivers/staging/vt6655/ioctl.c b/drivers/staging/vt6655/ioctl.c
index 970e80d..44e7616 100644
--- a/drivers/staging/vt6655/ioctl.c
+++ b/drivers/staging/vt6655/ioctl.c
@@ -620,11 +620,6 @@ int private_ioctl(struct vnt_private *pDevice, struct ifreq *rq)
 
 #ifdef WPA_SM_Transtatus
        case 0xFF:
-               memset(wpa_Result.ifname, 0, sizeof(wpa_Result.ifname));
-               wpa_Result.proto = 0;
-               wpa_Result.key_mgmt = 0;
-               wpa_Result.eap_type = 0;
-               wpa_Result.authenticated = false;
                pDevice->fWPA_Authened = false;
                if (copy_from_user(&wpa_Result, pReq->data, sizeof(wpa_Result))) {
                        result = -EFAULT;

We don't need to clear the values here or in device_open() because we
have that call to copy_from_user() which clears it again.

All the SndEvt_ToAPI code can be deleted because that's never defined.

Actually we could just delete the 0xFF ioctl because that is
non-standard.  It is only used as a hack to set ->fWPA_Authened probably
for debugging purposes.

So maybe the patch looks like:
[PATCH 1/2] vt6655: delete hacky non-standard ioctl
	(this would delete all the references to wpa_Result as well)
[PATCH 2/2] vt6655: delete SndEvt_ToAPI code
	(because it's never enabled)

regards,
dan carpenter
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux