Re: [PATCH] staging: comedi: tio: fix multiple missing break in switch bugs
On 11/10/2018 20:05, Gustavo A. R. Silva wrote: Currently, there are multiple missing break statements in two switch code blocks. This makes the execution path to fall all the way down through to the default cases, which makes the function ni_tio_set_gate_src() to always return -EINVAL. Fix this by adding the missing break statements. Also, notice that due to the absence of the break statements, the following pieces of code are unreachable: 1078if (ret) 1079return ret; 1080/* 3. reenable & set mode to starts things back up */ 1081ni_tio_set_gate_mode(counter, src); 1098if (ret) 1099return ret; 1100/* 3. reenable & set mode to starts things back up */ 1101ni_tio_set_gate2_mode(counter, src); So, by adding the missing breaks, this patch also fixes the problem above. Addresses-Coverity-ID: 1474165 ("Missing break in switch") Addresses-Coverity-ID: 1474162 ("Structurally dead code") Fixes: 347e244884c3 ("staging: comedi: tio: implement global tio/ctr routing") Signed-off-by: Gustavo A. R. Silva --- drivers/staging/comedi/drivers/ni_tio.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/staging/comedi/drivers/ni_tio.c b/drivers/staging/comedi/drivers/ni_tio.c index 838614e..0eb388c 100644 --- a/drivers/staging/comedi/drivers/ni_tio.c +++ b/drivers/staging/comedi/drivers/ni_tio.c @@ -1070,8 +1070,10 @@ int ni_tio_set_gate_src(struct ni_gpct *counter, case ni_gpct_variant_e_series: case ni_gpct_variant_m_series: ret = ni_m_set_gate(counter, chan); + break; case ni_gpct_variant_660x: ret = ni_660x_set_gate(counter, chan); + break; default: return -EINVAL; } @@ -1090,8 +1092,10 @@ int ni_tio_set_gate_src(struct ni_gpct *counter, switch (counter_dev->variant) { case ni_gpct_variant_m_series: ret = ni_m_set_gate2(counter, chan); + break; case ni_gpct_variant_660x: ret = ni_660x_set_gate2(counter, chan); + break; default: return -EINVAL; } Thanks for catching that bug! Reviewed-by: Ian Abbott -- -=( Ian Abbott || Web: www.mev.co.uk )=- -=( MEV Ltd. is a company registered in England & Wales. )=- -=( Registered number: 02862268. Registered address:)=- -=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=- ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: comedi: tio: fix multiple missing break in switch bugs
On 10/12/18 11:04 AM, Ian Abbott wrote: > On 11/10/2018 20:05, Gustavo A. R. Silva wrote: >> Currently, there are multiple missing break statements in two switch code >> blocks. This makes the execution path to fall all the way down through >> to the default cases, which makes the function ni_tio_set_gate_src() to >> always return -EINVAL. >> >> Fix this by adding the missing break statements. >> >> Also, notice that due to the absence of the break statements, >> the following pieces of code are unreachable: >> >> 1078 if (ret) >> 1079 return ret; >> 1080 /* 3. reenable & set mode to starts things back up */ >> 1081 ni_tio_set_gate_mode(counter, src); >> >> 1098 if (ret) >> 1099 return ret; >> 1100 /* 3. reenable & set mode to starts things back up */ >> 1101 ni_tio_set_gate2_mode(counter, src); >> >> So, by adding the missing breaks, this patch also fixes the problem >> above. >> >> Addresses-Coverity-ID: 1474165 ("Missing break in switch") >> Addresses-Coverity-ID: 1474162 ("Structurally dead code") >> Fixes: 347e244884c3 ("staging: comedi: tio: implement global tio/ctr >> routing") >> Signed-off-by: Gustavo A. R. Silva >> --- >> drivers/staging/comedi/drivers/ni_tio.c | 4 >> 1 file changed, 4 insertions(+) >> >> diff --git a/drivers/staging/comedi/drivers/ni_tio.c >> b/drivers/staging/comedi/drivers/ni_tio.c >> index 838614e..0eb388c 100644 >> --- a/drivers/staging/comedi/drivers/ni_tio.c >> +++ b/drivers/staging/comedi/drivers/ni_tio.c >> @@ -1070,8 +1070,10 @@ int ni_tio_set_gate_src(struct ni_gpct *counter, >> case ni_gpct_variant_e_series: >> case ni_gpct_variant_m_series: >> ret = ni_m_set_gate(counter, chan); >> + break; >> case ni_gpct_variant_660x: >> ret = ni_660x_set_gate(counter, chan); >> + break; >> default: >> return -EINVAL; >> } >> @@ -1090,8 +1092,10 @@ int ni_tio_set_gate_src(struct ni_gpct *counter, >> switch (counter_dev->variant) { >> case ni_gpct_variant_m_series: >> ret = ni_m_set_gate2(counter, chan); >> + break; >> case ni_gpct_variant_660x: >> ret = ni_660x_set_gate2(counter, chan); >> + break; >> default: >> return -EINVAL; >> } >> > > Thanks for catching that bug! > Glad to help. :) > Reviewed-by: Ian Abbott > Thanks -- Gustavo ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
URGENT RESPONSE NEEDED
Hello my dear. Did you receive my email message to you? Please, get back to me ASAP as the matter is becoming late. Expecting your urgent response. Sean. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8188eu: fix spelling mistake "Abnornally" -> "Abnormally"
From: Colin Ian King Trivial fix to spelling mistake in ODM_RT_TRACE trace message Signed-off-by: Colin Ian King --- drivers/staging/rtl8188eu/hal/odm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/hal/odm.c b/drivers/staging/rtl8188eu/hal/odm.c index 5a0c38ecb15e..4ab490c1c13b 100644 --- a/drivers/staging/rtl8188eu/hal/odm.c +++ b/drivers/staging/rtl8188eu/hal/odm.c @@ -418,7 +418,7 @@ void odm_DIG(struct odm_dm_struct *pDM_Odm) /* 1 Modify DIG lower bound, deal with abnormally large false alarm */ if (pFalseAlmCnt->Cnt_all > 1) { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("dm_DIG(): Abnornally false alarm case.\n")); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("dm_DIG(): Abnormally false alarm case.\n")); if (pDM_DigTable->LargeFAHit != 3) pDM_DigTable->LargeFAHit++; -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8723bs: fix spelling mistake "Abnrormal" -> "Abnormal"
From: Colin Ian King Trivial fix to spelling mistake in message text Signed-off-by: Colin Ian King --- drivers/staging/rtl8723bs/hal/odm_DIG.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_DIG.c b/drivers/staging/rtl8723bs/hal/odm_DIG.c index a12fdce77eae..4fa6cd315cf7 100644 --- a/drivers/staging/rtl8723bs/hal/odm_DIG.c +++ b/drivers/staging/rtl8723bs/hal/odm_DIG.c @@ -655,7 +655,7 @@ void odm_DIG(void *pDM_VOID) ODM_COMP_DIG, ODM_DBG_LOUD, ( - "odm_DIG(): Abnrormal #beacon (%d) case in STA mode: Force lower bound to 0x%x !!\n\n", + "odm_DIG(): Abnormal #beacon (%d) case in STA mode: Force lower bound to 0x%x !!\n\n", pDM_Odm->PhyDbgInfo.NumQryBeaconPkt, pDM_DigTable->rx_gain_range_min ) @@ -671,7 +671,7 @@ void odm_DIG(void *pDM_VOID) ODM_COMP_DIG, ODM_DBG_LOUD, ( - "odm_DIG(): Abnrormal lower bound case: Force lower bound to 0x%x !!\n\n", + "odm_DIG(): Abnormal lower bound case: Force lower bound to 0x%x !!\n\n", pDM_DigTable->rx_gain_range_min ) ); -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtlwifi: phydm: fix spelling mistake "Abnrormal" -> "Abnormal"
From: Colin Ian King Trivial fix to spelling mistake in message text Signed-off-by: Colin Ian King --- drivers/staging/rtlwifi/phydm/phydm_dig.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtlwifi/phydm/phydm_dig.c b/drivers/staging/rtlwifi/phydm/phydm_dig.c index 3115e7bdc749..f10776fbe2d9 100644 --- a/drivers/staging/rtlwifi/phydm/phydm_dig.c +++ b/drivers/staging/rtlwifi/phydm/phydm_dig.c @@ -813,7 +813,7 @@ void odm_DIG(void *dm_void) dig_tab->rx_gain_range_min = 0x1c; ODM_RT_TRACE( dm, ODM_COMP_DIG, - "DIG: Abnrormal #beacon (%d) case in STA mode: Force lower bound to 0x%x\n", + "DIG: Abnormal #beacon (%d) case in STA mode: Force lower bound to 0x%x\n", dm->phy_dbg_info.num_qry_beacon_pkt, dig_tab->rx_gain_range_min); } @@ -824,7 +824,7 @@ void odm_DIG(void *dm_void) dig_tab->rx_gain_range_min = dig_tab->rx_gain_range_max; ODM_RT_TRACE( dm, ODM_COMP_DIG, - "DIG: Abnrormal lower bound case: Force lower bound to 0x%x\n", + "DIG: Abnormal lower bound case: Force lower bound to 0x%x\n", dig_tab->rx_gain_range_min); } -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next] hv_netvsc: fix vf serial matching with pci slot info
> -Original Message- > From: Greg KH > Sent: Friday, October 12, 2018 2:36 AM > To: Haiyang Zhang > Cc: da...@davemloft.net; net...@vger.kernel.org; o...@aepfle.de; Stephen > Hemminger ; linux-ker...@vger.kernel.org; > de...@linuxdriverproject.org; vkuznets > Subject: Re: [PATCH net-next] hv_netvsc: fix vf serial matching with pci slot > info > > On Thu, Oct 11, 2018 at 08:14:34PM +, Haiyang Zhang wrote: > > From: Haiyang Zhang > > > > The VF device's serial number is saved as a string in PCI slot's kobj > > name, not the slot->number. This patch corrects the netvsc driver, so > > the VF device can be successfully paired with synthetic NIC. > > > > Fixes: 00d7ddba1143 ("hv_netvsc: pair VF based on serial number") > > Signed-off-by: Haiyang Zhang > > --- > > drivers/net/hyperv/netvsc_drv.c | 15 +++ > > 1 file changed, 11 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/net/hyperv/netvsc_drv.c > > b/drivers/net/hyperv/netvsc_drv.c index 9bcaf204a7d4..8121ce34a39f > > 100644 > > --- a/drivers/net/hyperv/netvsc_drv.c > > +++ b/drivers/net/hyperv/netvsc_drv.c > > @@ -2030,14 +2030,15 @@ static void netvsc_vf_setup(struct work_struct > *w) > > rtnl_unlock(); > > } > > > > -/* Find netvsc by VMBus serial number. > > - * The PCI hyperv controller records the serial number as the slot. > > +/* Find netvsc by VF serial number. > > + * The PCI hyperv controller records the serial number as the slot kobj > > name. > > */ > > static struct net_device *get_netvsc_byslot(const struct net_device > > *vf_netdev) { > > struct device *parent = vf_netdev->dev.parent; > > struct net_device_context *ndev_ctx; > > struct pci_dev *pdev; > > + u32 serial; > > > > if (!parent || !dev_is_pci(parent)) > > return NULL; /* not a PCI device */ @@ -2048,16 +2049,22 > @@ static > > struct net_device *get_netvsc_byslot(const struct net_device *vf_netdev) > > return NULL; > > } > > > > + if (kstrtou32(pdev->slot->kobj.name, 10, &serial)) { > > kobject_name()? > > And that feels _very_ fragile to me. This is now an api that you are > guaranteeing will never change? Thanks for the suggestion -- I will update it to use kobject_name() to access the name. For stability, the VF NIC's serial numbers are always unique according to the Hyper-V documents. Other devices may have same numbers, but they are not handled by netvsc driver. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH RESEND] staging: erofs: clean erofs_lookup()
From: Al Viro d_splice_alias() does the right thing when given ERR_PTR(-E...) for inode. No need for gotos, multiple returns, etc. in there. Signed-off-by: Al Viro Reviewed-by: Gao Xiang Signed-off-by: Gao Xiang --- Hi, Frankly, I think it is a straight-forward cleanup by Al enough to be submitted to Linux 4.20 in constant to other pending fixes found in the process of EROFS productization these days, which I need more time to think over and fix formally to the community. p.s. I have no idea whether this patch has been already queued up in Al's fs tree for 4.20... :'( +Cc Greg / the staging mailing list as well. Or please ignore this email... Thanks, Gao Xiang drivers/staging/erofs/namei.c | 19 +++ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/staging/erofs/namei.c b/drivers/staging/erofs/namei.c index 0039b76..5596c52 100644 --- a/drivers/staging/erofs/namei.c +++ b/drivers/staging/erofs/namei.c @@ -223,18 +223,13 @@ static struct dentry *erofs_lookup(struct inode *dir, if (err == -ENOENT) { /* negative dentry */ inode = NULL; - goto negative_out; - } else if (unlikely(err)) - return ERR_PTR(err); - - debugln("%s, %s (nid %llu) found, d_type %u", __func__, - dentry->d_name.name, nid, d_type); - - inode = erofs_iget(dir->i_sb, nid, d_type == EROFS_FT_DIR); - if (IS_ERR(inode)) - return ERR_CAST(inode); - -negative_out: + } else if (unlikely(err)) { + inode = ERR_PTR(err); + } else { + debugln("%s, %s (nid %llu) found, d_type %u", __func__, + dentry->d_name.name, nid, d_type); + inode = erofs_iget(dir->i_sb, nid, d_type == EROFS_FT_DIR); + } return d_splice_alias(inode, dentry); } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next, v2] hv_netvsc: fix vf serial matching with pci slot info
From: Haiyang Zhang The VF device's serial number is saved as a string in PCI slot's kobj name, not the slot->number. This patch corrects the netvsc driver, so the VF device can be successfully paired with synthetic NIC. Fixes: 00d7ddba1143 ("hv_netvsc: pair VF based on serial number") Reported-by: Vitaly Kuznetsov Signed-off-by: Haiyang Zhang --- drivers/net/hyperv/netvsc_drv.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 9bcaf204a7d4..ded623862003 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -2030,14 +2030,15 @@ static void netvsc_vf_setup(struct work_struct *w) rtnl_unlock(); } -/* Find netvsc by VMBus serial number. - * The PCI hyperv controller records the serial number as the slot. +/* Find netvsc by VF serial number. + * The PCI hyperv controller records the serial number as the slot kobj name. */ static struct net_device *get_netvsc_byslot(const struct net_device *vf_netdev) { struct device *parent = vf_netdev->dev.parent; struct net_device_context *ndev_ctx; struct pci_dev *pdev; + u32 serial; if (!parent || !dev_is_pci(parent)) return NULL; /* not a PCI device */ @@ -2048,16 +2049,22 @@ static struct net_device *get_netvsc_byslot(const struct net_device *vf_netdev) return NULL; } + if (kstrtou32(kobject_name(&pdev->slot->kobj), 10, &serial)) { + netdev_notice(vf_netdev, "Invalid vf serial:%s\n", + pdev->slot->kobj.name); + return NULL; + } + list_for_each_entry(ndev_ctx, &netvsc_dev_list, list) { if (!ndev_ctx->vf_alloc) continue; - if (ndev_ctx->vf_serial == pdev->slot->number) + if (ndev_ctx->vf_serial == serial) return hv_get_drvdata(ndev_ctx->device_ctx); } netdev_notice(vf_netdev, - "no netdev found for slot %u\n", pdev->slot->number); + "no netdev found for vf serial:%u\n", serial); return NULL; } -- 2.18.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net-next, v2] hv_netvsc: fix vf serial matching with pci slot info
On Fri, 12 Oct 2018 20:55:15 + Haiyang Zhang wrote: Thanks for fixing this. > + if (kstrtou32(kobject_name(&pdev->slot->kobj), 10, &serial)) { > + netdev_notice(vf_netdev, "Invalid vf serial:%s\n", > + pdev->slot->kobj.name); > + return NULL; > + } Shouldn't this use kobject_name() in the message as well. Looking at the pci.h code there is already an API to get name from slot (it uses kobject_name()). So please use that one. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next, v2] hv_netvsc: fix vf serial matching with pci slot info
> -Original Message- > From: Stephen Hemminger > Sent: Friday, October 12, 2018 6:21 PM > To: Haiyang Zhang > Cc: Haiyang Zhang ; da...@davemloft.net; > net...@vger.kernel.org; o...@aepfle.de; linux-ker...@vger.kernel.org; > de...@linuxdriverproject.org; vkuznets > Subject: Re: [PATCH net-next, v2] hv_netvsc: fix vf serial matching with pci > slot > info > > On Fri, 12 Oct 2018 20:55:15 + > Haiyang Zhang wrote: > > Thanks for fixing this. > > > > + if (kstrtou32(kobject_name(&pdev->slot->kobj), 10, &serial)) { > > + netdev_notice(vf_netdev, "Invalid vf serial:%s\n", > > + pdev->slot->kobj.name); > > + return NULL; > > + } > > Shouldn't this use kobject_name() in the message as well. > > Looking at the pci.h code there is already an API to get name from slot (it > uses > kobject_name()). So please use that one. Sure, I will look for that api. Thanks. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8188eu: fix spelling mistake "EINPROGESS" -> "EINPROGRESS"
From: Colin Ian King Trivial fix to spelling mistake in RT_TRACE message text. Signed-off-by: Colin Ian King --- drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c index 43f031d644fd..d6a499692e96 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c @@ -606,7 +606,7 @@ static void usb_write_port_complete(struct urb *purb, struct pt_regs *regs) if ((purb->status == -EPIPE) || (purb->status == -EPROTO)) { sreset_set_wifi_error_status(padapter, USB_WRITE_PORT_FAIL); } else if (purb->status == -EINPROGRESS) { - RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("usb_write_port_complete: EINPROGESS\n")); + RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("usb_write_port_complete: EINPROGRESS\n")); goto check_completion; } else if (purb->status == -ENOENT) { DBG_88E("%s: -ENOENT\n", __func__); -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel