Re: [PATCH] media: atomisp: silence "dubious: !x | !y" warning
On Sat, Apr 17, 2021 at 09:31:32PM +, David Laight wrote: > > > Upon running sparse, "warning: dubious: !x | !y" is brought to notice > > > for this file. Logical and bitwise OR are basically the same in this > > > context so it doesn't cause a runtime bug. But let's change it to > > > logical OR to make it cleaner and silence the Sparse warning. > > The old code is very likely to by slightly more efficient. > > It may not matter here, but it might in a really hot path. > > Since !x | !y and !x || !y always have the same value > why is sparse complaining at all. They both will have the same value here and any half-decent compiler know that and thus generate the same code, so no worries about efficiency. Sparse complains because the programmer's intention is not clear. Was a boolean context or a bitwise context that was meant? Maybe '||' was meant and the RHS had to be short cut? Maybe what was meant was '~x | ~y'? -- Luc ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: rtl8192e, rtl8192u: use correct notation to define pointer
On Tue, Oct 27, 2020 at 12:23:03PM +0100, Greg KH wrote: > > Are you sure these changes are correct? This isn't just a list of > structures after this at the end of the structure? > > Please look at commit 5979afa2c4d1 ("staging: Replace zero-length array > with flexible-array member") which made most of these flexible arrays. > > This is not a pointer, it really is an array, I think sparse is really > wrong here, be careful. Sparse's warning is not about changing the definition of this member as if it was the argument of a function. It's about how can you use an array of structure when this structure has a flexible member. It's a recent warning, added purposely to catch this. See https://lore.kernel.org/r/CAHk-=wgjz05ap8vqdzwdwjvwvtzioytc6cnnb8gneqzenfm...@mail.gmail.com -- Luc ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: ks7010: fix ks_wlan_start_xmit()'s return type
The method ndo_start_xmit() is defined as returning an 'netdev_tx_t', which is a typedef for an enum type, but the implementation in this driver returns an 'int'. Fix this by returning 'netdev_tx_t' in this driver too and usind 'NETDEV_TX_OK' instead of 0 accordingly. Signed-off-by: Luc Van Oostenryck --- drivers/staging/ks7010/ks_wlan_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index 211dd4a11cac..334ae1ded684 100644 --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -46,7 +46,7 @@ struct wep_key { */ static int ks_wlan_open(struct net_device *dev); static void ks_wlan_tx_timeout(struct net_device *dev, unsigned int txqueue); -static int ks_wlan_start_xmit(struct sk_buff *skb, struct net_device *dev); +static netdev_tx_t ks_wlan_start_xmit(struct sk_buff *skb, struct net_device *dev); static int ks_wlan_close(struct net_device *dev); static void ks_wlan_set_rx_mode(struct net_device *dev); static struct net_device_stats *ks_wlan_get_stats(struct net_device *dev); @@ -2511,7 +2511,7 @@ void ks_wlan_tx_timeout(struct net_device *dev, unsigned int txqueue) } static -int ks_wlan_start_xmit(struct sk_buff *skb, struct net_device *dev) +netdev_tx_t ks_wlan_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct ks_wlan_private *priv = netdev_priv(dev); int ret; -- 2.27.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging/wilc1000: let wilc_mac_xmit() to NETDEV_TX_OK
The method ndo_start_xmit() is defined as returning an 'netdev_tx_t', which is a typedef for an enum type defining 'NETDEV_TX_OK' but this driver returns '0' instead of 'NETDEV_TX_OK'. Fix this by returning ''NETDEV_TX_OK' instead of 0. Signed-off-by: Luc Van Oostenryck --- drivers/staging/wilc1000/netdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/netdev.c b/drivers/staging/wilc1000/netdev.c index fda0ab97b02c..be3ae5486f44 100644 --- a/drivers/staging/wilc1000/netdev.c +++ b/drivers/staging/wilc1000/netdev.c @@ -678,14 +678,14 @@ netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev) if (skb->dev != ndev) { netdev_err(ndev, "Packet not destined to this device\n"); - return 0; + return NETDEV_TX_OK; } tx_data = kmalloc(sizeof(*tx_data), GFP_ATOMIC); if (!tx_data) { dev_kfree_skb(skb); netif_wake_queue(ndev); - return 0; + return NETDEV_TX_OK; } tx_data->buff = skb->data; @@ -710,7 +710,7 @@ netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev) srcu_read_unlock(>srcu, srcu_idx); } - return 0; + return NETDEV_TX_OK; } static int wilc_mac_close(struct net_device *ndev) -- 2.27.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Removing ununsed variable int lo, hi, int data and int i from comedi/drivers/dt2814.c.
On Sun, May 24, 2020 at 07:02:20PM +0530, GAURAV PATHAK wrote: > > For few drivers, I am getting: > > CC [M] drivers/staging/vt6656/key.o > CHECK drivers/staging/vt6656/rf.c > /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h:417:9: warning: preprocessor > token offsetof redefined > ./include/linux/stddef.h:17:9: this was the original definition > > but I guess these are false positive, as #undef offsetof is already present > in ./include/linux/stddef.h. But there is no #undef in /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h which seems to be sometimes included after Linux's include/linux/stddef.h -- Luc ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Removing ununsed variable int lo, hi, int data and int i from comedi/drivers/dt2814.c.
On Sun, May 24, 2020 at 06:19:22PM +0530, GAURAV PATHAK wrote: > Thanks a lot for your reply. > I am trying to run sparse on drivers/staging directory, > but I am not getting any useful warnings. > Steps that I did: > > - Referred https://www.kernel.org/doc/man-pages/linux-next.html to get > linux-next latest tag next-20200522. > - After that executed following commands: > - make mrproper; make clean; make distclean > - make defconfig > - make menuconfig (Enabled all Staging Drivers with M) > - make modules_prepare > - make C=1 M=drivers/staging (Also tried individual directories > inside staging directory e.g. make C=1 > M=drivers/staging/comedi/drivers) > > I am not getting any warning, I have attached the output in text format. > > Any pointers for finding warning using sparse in drivers/staging > directory will be helpful. I really appretiate your guidance in this > regard. Well it seems that most staging drivers have no sparse warnings at all. I only see somes in the following staging drivers: drivers/staging/isdn/ drivers/staging/kpc2000/ drivers/staging/uwb/ drivers/staging/vc04_services/ drivers/staging/wfx/ drivers/staging/wusbcore/ Your commands seems to be good but I would advice you to use 'C=2' instead of 'C=1' in order for sparse to effectively run on each input file even when the corresponding .o file already exists. The simplest to use is: - make allmodconfig - make -j8 drivers/staging/ This will just compile all the files without running sparse. So all warnings will be from the compiler. The you can run: - make C=2 drivers/staging/ which will only run sparse (and will thus be much faster). Best regards, -- Luc ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Removing ununsed variable int lo, hi, int data and int i from comedi/drivers/dt2814.c.
Hi, On Sun, May 24, 2020 at 05:06:18PM +0530, Gaurav Pathak wrote: > Silence following sparse warning: > drivers/staging/comedi/drivers/dt2814.c: In function ‘dt2814_interrupt’: > drivers/staging/comedi/drivers/dt2814.c:193:6: warning: variable ‘data’ set > but not used [-Wunused-but-set-variable] > int data; > ^~~~ > drivers/staging/comedi/drivers/dt2814.c: In function ‘dt2814_attach’: > drivers/staging/comedi/drivers/dt2814.c:232:6: warning: variable ‘i’ set but > not used [-Wunused-but-set-variable] > int i; > ^ These warnings are not from sparse but simply from the compiler. > static irqreturn_t dt2814_interrupt(int irq, void *d) > { > - int lo, hi; > struct comedi_device *dev = d; > struct dt2814_private *devpriv = dev->private; > struct comedi_subdevice *s = dev->read_subdev; > - int data; > > if (!dev->attached) { > dev_err(dev->class_dev, "spurious interrupt\n"); > return IRQ_HANDLED; > } > > - hi = inb(dev->iobase + DT2814_DATA); > - lo = inb(dev->iobase + DT2814_DATA); > - > - data = (hi << 4) | (lo >> 4); OK, 'data' is unused but are these 2 'inb(dev->iobase + DT2814_DATA)' needed or not? I would guess that they're needed but I don't know this hardware. > @@ -241,8 +233,6 @@ static int dt2814_attach(struct comedi_device *dev, > struct comedi_devconfig *it) > dev_err(dev->class_dev, "reset error (fatal)\n"); > return -EIO; > } > - i = inb(dev->iobase + DT2814_DATA); > - i = inb(dev->iobase + DT2814_DATA); Same here. -- Luc ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: wilc1000: fix cast to restricted __le32
On Mon, Jan 07, 2019 at 03:54:37PM +0300, Dan Carpenter wrote: > I'm sort of surprised that the zero day bot didn't complain about this. > It probably should. > > The endianness checking is not turned on by default in Sparse. You have > to do "make C=1 CF=-D__CHECK_ENDIAN__" to turn it on. Bitwise (and thus endian) checking is enabled by default in the kernel since 05de97003 ("linux/types.h: enable endian checks for all sparse builds") included in v4.10-rc1. Since then they make more than half of sparse warnings (in a x86-64 allyesconfig). Best regards, -- Luc ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] binder: fix sparse warnings on locking context
On Mon, Dec 03, 2018 at 12:24:54PM -0800, Todd Kjos wrote: > Add __acquire()/__release() annnotations to fix warnings > in sparse context checking > > There is one case where the warning was due to a lack of > a "default:" case in a switch statement where a lock was > being released in each of the cases, so the default > case was added. > > Signed-off-by: Todd Kjos > --- > drivers/android/binder.c | 43 +- > drivers/android/binder_alloc.c | 1 + > 2 files changed, 43 insertions(+), 1 deletion(-) > > diff --git a/drivers/android/binder.c b/drivers/android/binder.c > index 9f1000d2a40c7..9f2059d24ae2d 100644 > --- a/drivers/android/binder.c > +++ b/drivers/android/binder.c > @@ -751,12 +757,16 @@ _binder_node_unlock(struct binder_node *node, int line) > #define binder_node_inner_lock(node) _binder_node_inner_lock(node, __LINE__) > static void > _binder_node_inner_lock(struct binder_node *node, int line) > + __acquires(>lock) __acquires(>proc->inner_lock) > { > binder_debug(BINDER_DEBUG_SPINLOCKS, >"%s: line=%d\n", __func__, line); > spin_lock(>lock); > if (node->proc) > binder_inner_proc_lock(node->proc); > + else > + /* annotation for sparse */ > + __acquire(>proc->inner_lock); This one is questionnable because: 1) if !node->proc, then '>proc->inner_lock' is not acquired since it doesn't even exist. 2) OTOH, the function can't have the annotation 100% right because it semantics allows unbalanced locking depending on node->proc being null or not. But I see very well the intent and maybe it's a right solution. I dunno. Same for most of the following ones. Best regards, -- Luc Van Oostenryck ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging/wilc1000: fix wilc_mac_xmit()'s return type
The method ndo_start_xmit() is defined as returning an 'netdev_tx_t', which is a typedef for an enum type, but the implementation in this driver returns an 'int'. Fix this by returning 'netdev_tx_t' in this driver too and accordingly change 'return 0;' by 'return NETDEV_TX_OK;' Signed-off-by: Luc Van Oostenryck <luc.vanoostenr...@gmail.com> --- drivers/staging/wilc1000/linux_wlan.c | 8 drivers/staging/wilc1000/wilc_wlan.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 38a83bd31..d95b9750b 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -941,7 +941,7 @@ static void linux_wlan_tx_complete(void *priv, int status) kfree(pv_data); } -int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev) +netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev) { struct wilc_vif *vif; struct tx_complete_data *tx_data = NULL; @@ -956,14 +956,14 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev) if (skb->dev != ndev) { netdev_err(ndev, "Packet not destined to this device\n"); - return 0; + return NETDEV_TX_OK; } tx_data = kmalloc(sizeof(*tx_data), GFP_ATOMIC); if (!tx_data) { dev_kfree_skb(skb); netif_wake_queue(ndev); - return 0; + return NETDEV_TX_OK; } tx_data->buff = skb->data; @@ -994,7 +994,7 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev) netif_stop_queue(wilc->vif[1]->ndev); } - return 0; + return NETDEV_TX_OK; } static int wilc_mac_close(struct net_device *ndev) diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index fa157a67b..d3b5a6b38 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -298,7 +298,7 @@ void wilc_chip_sleep_manually(struct wilc *wilc); void wilc_enable_tcp_ack_filter(bool value); int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc); -int wilc_mac_xmit(struct sk_buff *skb, struct net_device *dev); +netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *dev); void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size); void host_wakeup_notify(struct wilc *wilc); -- 2.17.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging/wilc1000: fix wilc_mac_xmit()'s return type
The method ndo_start_xmit() is defined as returning an 'netdev_tx_t', which is a typedef for an enum type, but the implementation in this driver returns an 'int'. Fix this by returning 'netdev_tx_t' in this driver too. Signed-off-by: Luc Van Oostenryck <luc.vanoostenr...@gmail.com> --- drivers/staging/wilc1000/linux_wlan.c | 2 +- drivers/staging/wilc1000/wilc_wlan.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 38a83bd31..e06aaed5e 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -941,7 +941,7 @@ static void linux_wlan_tx_complete(void *priv, int status) kfree(pv_data); } -int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev) +netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev) { struct wilc_vif *vif; struct tx_complete_data *tx_data = NULL; diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index fa157a67b..d3b5a6b38 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -298,7 +298,7 @@ void wilc_chip_sleep_manually(struct wilc *wilc); void wilc_enable_tcp_ack_filter(bool value); int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc); -int wilc_mac_xmit(struct sk_buff *skb, struct net_device *dev); +netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *dev); void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size); void host_wakeup_notify(struct wilc *wilc); -- 2.17.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: wlan-ng: fix p80211knetdev_hard_start_xmit()'s return type
The method ndo_start_xmit() is defined as returning an 'netdev_tx_t', which is a typedef for an enum type, but the implementation in this driver returns an 'int'. Fix this by returning 'netdev_tx_t' in this driver too. Signed-off-by: Luc Van Oostenryck <luc.vanoostenr...@gmail.com> --- drivers/staging/wlan-ng/p80211netdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c index ec9cc00ee..710ce8394 100644 --- a/drivers/staging/wlan-ng/p80211netdev.c +++ b/drivers/staging/wlan-ng/p80211netdev.c @@ -95,7 +95,7 @@ static int p80211knetdev_init(struct net_device *netdev); static int p80211knetdev_open(struct net_device *netdev); static int p80211knetdev_stop(struct net_device *netdev); -static int p80211knetdev_hard_start_xmit(struct sk_buff *skb, +static netdev_tx_t p80211knetdev_hard_start_xmit(struct sk_buff *skb, struct net_device *netdev); static void p80211knetdev_set_multicast_list(struct net_device *dev); static int p80211knetdev_do_ioctl(struct net_device *dev, struct ifreq *ifr, @@ -321,7 +321,7 @@ static void p80211netdev_rx_bh(unsigned long arg) * zero on success, non-zero on failure. * */ -static int p80211knetdev_hard_start_xmit(struct sk_buff *skb, +static netdev_tx_t p80211knetdev_hard_start_xmit(struct sk_buff *skb, struct net_device *netdev) { int result = 0; -- 2.17.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8723bs: fix rtw_cfg80211_monitor_if_xmit_entry()'s return type
The method ndo_start_xmit() is defined as returning an 'netdev_tx_t', which is a typedef for an enum type, but the implementation in this driver returns an 'int'. Fix this by returning 'netdev_tx_t' in this driver too. Signed-off-by: Luc Van Oostenryck <luc.vanoostenr...@gmail.com> --- drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c index 46bc2e512..75d8a16f5 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c @@ -2472,7 +2472,7 @@ static int rtw_cfg80211_monitor_if_close(struct net_device *ndev) return ret; } -static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_device *ndev) +static netdev_tx_t rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_device *ndev) { int ret = 0; int rtap_len; -- 2.17.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: ks7010: fix ks_wlan_start_xmit()'s return type
The method ndo_start_xmit() is defined as returning an 'netdev_tx_t', which is a typedef for an enum type, but the implementation in this driver returns an 'int'. Fix this by returning 'netdev_tx_t' in this driver too. Signed-off-by: Luc Van Oostenryck <luc.vanoostenr...@gmail.com> --- drivers/staging/ks7010/ks_wlan_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index 9078e13b0..57412caac 100644 --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -71,7 +71,7 @@ static const struct iw_handler_def ks_wlan_handler_def; */ static int ks_wlan_open(struct net_device *dev); static void ks_wlan_tx_timeout(struct net_device *dev); -static int ks_wlan_start_xmit(struct sk_buff *skb, struct net_device *dev); +static netdev_tx_t ks_wlan_start_xmit(struct sk_buff *skb, struct net_device *dev); static int ks_wlan_close(struct net_device *dev); static void ks_wlan_set_multicast_list(struct net_device *dev); static struct net_device_stats *ks_wlan_get_stats(struct net_device *dev); @@ -2772,7 +2772,7 @@ void ks_wlan_tx_timeout(struct net_device *dev) } static -int ks_wlan_start_xmit(struct sk_buff *skb, struct net_device *dev) +netdev_tx_t ks_wlan_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct ks_wlan_private *priv = netdev_priv(dev); int ret; -- 2.17.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: visornic: fix visornic_xmit()'s return type
The method ndo_start_xmit() is defined as returning an 'netdev_tx_t', which is a typedef for an enum type, but the implementation in this driver returns an 'int'. Fix this by returning 'netdev_tx_t' in this driver too. Signed-off-by: Luc Van Oostenryck <luc.vanoostenr...@gmail.com> --- drivers/staging/unisys/visornic/visornic_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 92dceb557..f734e835b 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -849,7 +849,7 @@ static bool vnic_hit_low_watermark(struct visornic_devdata *devdata, * * Return: NETDEV_TX_OK. */ -static int visornic_xmit(struct sk_buff *skb, struct net_device *netdev) +static netdev_tx_t visornic_xmit(struct sk_buff *skb, struct net_device *netdev) { struct visornic_devdata *devdata; int len, firstfraglen, padlen; -- 2.17.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: gdm724x: fix gdm_lte_tx()'s return type
The method ndo_start_xmit() is defined as returning an 'netdev_tx_t', which is a typedef for an enum type, but the implementation in this driver returns an 'int'. Fix this by returning 'netdev_tx_t' in this driver too. Signed-off-by: Luc Van Oostenryck <luc.vanoostenr...@gmail.com> --- drivers/staging/gdm724x/gdm_lte.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/gdm724x/gdm_lte.c b/drivers/staging/gdm724x/gdm_lte.c index 4f3c51830..1f8a33f04 100644 --- a/drivers/staging/gdm724x/gdm_lte.c +++ b/drivers/staging/gdm724x/gdm_lte.c @@ -408,7 +408,7 @@ static s32 gdm_lte_tx_nic_type(struct net_device *dev, struct sk_buff *skb) return nic_type; } -static int gdm_lte_tx(struct sk_buff *skb, struct net_device *dev) +static netdev_tx_t gdm_lte_tx(struct sk_buff *skb, struct net_device *dev) { struct nic *nic = netdev_priv(dev); u32 nic_type; -- 2.17.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] hv_netsvc: fix netvsc_start_xmit()'s return type
The method ndo_start_xmit() is defined as returning an 'netdev_tx_t', which is a typedef for an enum type, but the implementation in this driver returns an 'int'. Fix this by returning 'netdev_tx_t' in this driver too. Signed-off-by: Luc Van Oostenryck <luc.vanoostenr...@gmail.com> --- drivers/net/hyperv/netvsc_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index ecc84954c..d402fdb08 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -508,7 +508,7 @@ static int netvsc_vf_xmit(struct net_device *net, struct net_device *vf_netdev, return rc; } -static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) +static netdev_tx_t netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) { struct net_device_context *net_device_ctx = netdev_priv(net); struct hv_netvsc_packet *packet = NULL; -- 2.17.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] vboxvideo: fix mode_valid's return type
The method struct drm_connector_helper_funcs::mode_valid is defined as returning an 'enum drm_mode_status' but the driver implementation for this method uses an 'int' for it. Fix this by using 'enum drm_mode_status' in the driver too. Signed-off-by: Luc Van Oostenryck <luc.vanoostenr...@gmail.com> --- drivers/staging/vboxvideo/vbox_mode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vboxvideo/vbox_mode.c b/drivers/staging/vboxvideo/vbox_mode.c index b265fe924..5c7ea2378 100644 --- a/drivers/staging/vboxvideo/vbox_mode.c +++ b/drivers/staging/vboxvideo/vbox_mode.c @@ -573,7 +573,7 @@ static int vbox_get_modes(struct drm_connector *connector) return num_modes; } -static int vbox_mode_valid(struct drm_connector *connector, +static enum drm_mode_status vbox_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode) { return MODE_OK; -- 2.17.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/1] staging: ks7010: Fix cast to restricted __le16 in ks_wlan_net.c
On Sun, Jul 2, 2017 at 10:49 PM, Janusz Lisiecki <janusz.lisie...@gmail.com> wrote: > W dniu 2017-07-02 o 21:38, Luc Van Oostenryck pisze: > >> On Sun, Jul 2, 2017 at 4:27 PM, Janusz Lisiecki >> <janusz.lisie...@gmail.com> wrote: >>> >>> This patch fixes the following Sparse warnings in ks_wlan_net.c: >>> drivers/staging/ks7010/ks_wlan_net.c:1359:24: warning: cast to restricted >>> __le16 >>> Both sides of assignment are u16 so (as 'ap' is local_ap_t type and >>> 'capability' member, >>> have the same as local 'capabilities' type of u16) 'le16_to_cpu' is not >>> needed >> >> It could be that it's ap->capability's type that is wrong (not >> annotated with __le16). >> Isn't it? >> >> Is ap->capability supposed to hold a little-endian value or a native >> order value? >> >> -- Luc > > As I see in ks_hostif.c all assignments to link_ap_info_t->capability threat > this value as native order (i.e get_ap_information, get_current_ap). As this > is not a structure which comes from HW we can do the way you suggested. > Still, as all other places in code threats this as native order value I > decided to change only one place than many other around to fix Sparse > warning. Fine, but then please put this explanation in the commit message. In others words, be very clear that the change is because ap->capability is in native order and thus the conversion le16_to_cpu() is wrong and must be removed. -- Luc ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/1] staging: ks7010: Fix cast to restricted __le16 in ks_wlan_net.c
On Sun, Jul 2, 2017 at 4:27 PM, Janusz Lisieckiwrote: > This patch fixes the following Sparse warnings in ks_wlan_net.c: > drivers/staging/ks7010/ks_wlan_net.c:1359:24: warning: cast to restricted > __le16 > Both sides of assignment are u16 so (as 'ap' is local_ap_t type and > 'capability' member, > have the same as local 'capabilities' type of u16) 'le16_to_cpu' is not needed It could be that it's ap->capability's type that is wrong (not annotated with __le16). Isn't it? Is ap->capability supposed to hold a little-endian value or a native order value? -- Luc ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel