Re: svn commit: r348286 - in head/sys/dev: ctau cxgbe

2019-05-26 Thread Alexey Dokuchaev
On Sun, May 26, 2019 at 07:05:20AM -0700, Enji Cooper wrote:
> > On May 26, 2019, at 05:41, Alexey Dokuchaev  wrote:
> > New Revision: 348286
> > URL: https://svnweb.freebsd.org/changeset/base/348286
> > 
> > Log:
> >  Fix two errors reported by PVS Studio: V646 Consider inspecting the
> >  application's logic.  It's possible that 'else' keyword is missing.
> > 
> > ...
> > Modified: head/sys/dev/ctau/ctddk.c
> > --- head/sys/dev/ctau/ctddk.cSun May 26 03:52:35 2019(r348285)
> > +++ head/sys/dev/ctau/ctddk.cSun May 26 12:41:03 2019(r348286)
> > @@ -237,7 +237,7 @@ int ct_set_clk (ct_chan_t *c, int clk)
> >if (c->mode == M_E1) {
> >ct_setup_e1 (c->board);
> >return 0;
> > -} if (c->mode == M_G703) {
> > +} else if (c->mode == M_G703) {
> >ct_setup_g703 (c->board);
> >return 0;
> >} else
> 
> This seems like a good candidate for a switch-case logical block.

Perhaps.  I'm currently doing some PVS Studio runs over our kernel
and these were just some low-hanging fruit I wanted to fix.  Several
others had been forwarded to commit authors, and some already fixed.

./danfe
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r348286 - in head/sys/dev: ctau cxgbe

2019-05-26 Thread Enji Cooper


> On May 26, 2019, at 05:41, Alexey Dokuchaev  wrote:
> 
> Author: danfe (ports committer)
> Date: Sun May 26 12:41:03 2019
> New Revision: 348286
> URL: https://svnweb.freebsd.org/changeset/base/348286
> 
> Log:
>  Fix two errors reported by PVS Studio: V646 Consider inspecting the
>  application's logic.  It's possible that 'else' keyword is missing.
> 
>  Reviewed by:gallatin, np, pfg
>  Approved by:pfg
>  Differential Revision:https://reviews.freebsd.org/D20396
> 
> Modified:
>  head/sys/dev/ctau/ctddk.c
>  head/sys/dev/cxgbe/t4_main.c
> 
> Modified: head/sys/dev/ctau/ctddk.c
> ==
> --- head/sys/dev/ctau/ctddk.cSun May 26 03:52:35 2019(r348285)
> +++ head/sys/dev/ctau/ctddk.cSun May 26 12:41:03 2019(r348286)
> @@ -237,7 +237,7 @@ int ct_set_clk (ct_chan_t *c, int clk)
>if (c->mode == M_E1) {
>ct_setup_e1 (c->board);
>return 0;
> -} if (c->mode == M_G703) {
> +} else if (c->mode == M_G703) {
>ct_setup_g703 (c->board);
>return 0;
>} else

This seems like a good candidate for a switch-case logical block.
Cheers,
-Enji
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r348286 - in head/sys/dev: ctau cxgbe

2019-05-26 Thread Alexey Dokuchaev
Author: danfe (ports committer)
Date: Sun May 26 12:41:03 2019
New Revision: 348286
URL: https://svnweb.freebsd.org/changeset/base/348286

Log:
  Fix two errors reported by PVS Studio: V646 Consider inspecting the
  application's logic.  It's possible that 'else' keyword is missing.
  
  Reviewed by:  gallatin, np, pfg
  Approved by:  pfg
  Differential Revision:https://reviews.freebsd.org/D20396

Modified:
  head/sys/dev/ctau/ctddk.c
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/ctau/ctddk.c
==
--- head/sys/dev/ctau/ctddk.c   Sun May 26 03:52:35 2019(r348285)
+++ head/sys/dev/ctau/ctddk.c   Sun May 26 12:41:03 2019(r348286)
@@ -237,7 +237,7 @@ int ct_set_clk (ct_chan_t *c, int clk)
if (c->mode == M_E1) {
ct_setup_e1 (c->board);
return 0;
-   } if (c->mode == M_G703) {
+   } else if (c->mode == M_G703) {
ct_setup_g703 (c->board);
return 0;
} else

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cSun May 26 03:52:35 2019
(r348285)
+++ head/sys/dev/cxgbe/t4_main.cSun May 26 12:41:03 2019
(r348286)
@@ -9709,7 +9709,7 @@ set_offload_policy(struct adapter *sc, struct t4_offlo
/* Delete installed policies. */
op = NULL;
goto set_policy;
-   } if (uop->nrules > 256) { /* arbitrary */
+   } else if (uop->nrules > 256) { /* arbitrary */
return (E2BIG);
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"