Date: Mon, 23 Nov 1998 07:36:13 -0600 (CST) From: bradley@dunn.org To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: kern/8821: "warning: suggest parentheses" fixes Message-ID: <199811231336.HAA12196@magnate.dunn.org>
index | next in thread | raw e-mail
>Number: 8821
>Category: kern
>Synopsis: "warning: suggest parentheses" fixes
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Nov 23 05:40:00 PST 1998
>Last-Modified:
>Originator: Bradley Dunn
>Organization:
>Release: FreeBSD 3.0-CURRENT i386
>Environment:
>Description:
The attached patches fix all "warning: suggest parentheses"
in src/sys/dev
>How-To-Repeat:
>Fix:
--- src/sys/dev/ccd/ccd.c.old Mon Nov 23 06:41:47 1998
+++ src/sys/dev/ccd/ccd.c Mon Nov 23 06:48:26 1998
@@ -316,8 +316,8 @@
* Copy in the pathname of the component.
*/
bzero(tmppath, sizeof(tmppath)); /* sanity */
- if (error = copyinstr(cpaths[ix], tmppath,
- MAXPATHLEN, &ci->ci_pathlen)) {
+ if ((error = copyinstr(cpaths[ix], tmppath,
+ MAXPATHLEN, &ci->ci_pathlen))) {
#ifdef DEBUG
if (ccddebug & (CCDB_FOLLOW|CCDB_INIT))
printf("ccd%d: can't copy path, error = %d\n",
@@ -336,7 +336,7 @@
/*
* XXX: Cache the component's dev_t.
*/
- if (error = VOP_GETATTR(vp, &va, p->p_ucred, p)) {
+ if ((error = VOP_GETATTR(vp, &va, p->p_ucred, p))) {
#ifdef DEBUG
if (ccddebug & (CCDB_FOLLOW|CCDB_INIT))
printf("ccd%d: %s: getattr failed %s = %d\n",
@@ -355,8 +355,8 @@
/*
* Get partition information for the component.
*/
- if (error = VOP_IOCTL(vp, DIOCGPART, (caddr_t)&dpart,
- FREAD, p->p_ucred, p)) {
+ if ((error = VOP_IOCTL(vp, DIOCGPART, (caddr_t)&dpart,
+ FREAD, p->p_ucred, p))) {
#ifdef DEBUG
if (ccddebug & (CCDB_FOLLOW|CCDB_INIT))
printf("ccd%d: %s: ioctl failed, error = %d\n",
@@ -616,7 +616,7 @@
return (ENXIO);
cs = &ccd_softc[unit];
- if (error = ccdlock(cs))
+ if ((error = ccdlock(cs)))
return (error);
lp = &cs->sc_dkdev.dk_label;
@@ -677,7 +677,7 @@
return (ENXIO);
cs = &ccd_softc[unit];
- if (error = ccdlock(cs))
+ if ((error = ccdlock(cs)))
return (error);
part = ccdpart(dev);
@@ -1060,7 +1060,7 @@
if ((flag & FWRITE) == 0)
return (EBADF);
- if (error = ccdlock(cs))
+ if ((error = ccdlock(cs)))
return (error);
/* Fill in some important bits. */
@@ -1115,7 +1115,7 @@
if (ccddebug & CCDB_INIT)
printf("ccdioctl: lookedup = %d\n", lookedup);
#endif
- if (error = ccdlookup(cpp[i], p, &vpp[i])) {
+ if ((error = ccdlookup(cpp[i], p, &vpp[i]))) {
for (j = 0; j < lookedup; ++j)
(void)vn_close(vpp[j], FREAD|FWRITE,
p->p_ucred, p);
@@ -1133,7 +1133,7 @@
/*
* Initialize the ccd. Fills in the softc for us.
*/
- if (error = ccdinit(&ccd, cpp, p)) {
+ if ((error = ccdinit(&ccd, cpp, p))) {
for (j = 0; j < lookedup; ++j)
(void)vn_close(vpp[j], FREAD|FWRITE,
p->p_ucred, p);
@@ -1164,7 +1164,7 @@
if ((flag & FWRITE) == 0)
return (EBADF);
- if (error = ccdlock(cs))
+ if ((error = ccdlock(cs)))
return (error);
/*
@@ -1251,7 +1251,7 @@
if ((flag & FWRITE) == 0)
return (EBADF);
- if (error = ccdlock(cs))
+ if ((error = ccdlock(cs)))
return (error);
cs->sc_flags |= CCDF_LABELLING;
@@ -1347,7 +1347,7 @@
int error;
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, path, p);
- if (error = vn_open(&nd, FREAD|FWRITE, 0)) {
+ if ((error = vn_open(&nd, FREAD|FWRITE, 0))) {
#ifdef DEBUG
if (ccddebug & CCDB_FOLLOW|CCDB_INIT)
printf("ccdlookup: vn_open error = %d\n", error);
@@ -1362,7 +1362,7 @@
return (EBUSY);
}
- if (error = VOP_GETATTR(vp, &va, p->p_ucred, p)) {
+ if ((error = VOP_GETATTR(vp, &va, p->p_ucred, p))) {
#ifdef DEBUG
if (ccddebug & CCDB_FOLLOW|CCDB_INIT)
printf("ccdlookup: getattr error = %d\n", error);
@@ -1434,8 +1434,8 @@
/*
* Call the generic disklabel extraction routine.
*/
- if (errstring = readdisklabel(CCDLABELDEV(dev), ccdstrategy,
- &cs->sc_dkdev.dk_label))
+ if ((errstring = readdisklabel(CCDLABELDEV(dev), ccdstrategy,
+ &cs->sc_dkdev.dk_label)))
ccdmakedisklabel(cs);
#ifdef DEBUG
--- src/sys/dev/en/midway.c.old Mon Nov 23 06:48:53 1998
+++ src/sys/dev/en/midway.c Mon Nov 23 06:49:55 1998
@@ -1274,7 +1274,7 @@
do {
struct ifnet *shadow;
- if (error = suser(curproc->p_ucred, &curproc->p_acflag))
+ if ((error = suser(curproc->p_ucred, &curproc->p_acflag)))
break;
if ((shadow = pvc_attach(ifp)) != NULL) {
--- src/sys/dev/hea/eni_if.c.old Mon Nov 23 06:50:30 1998
+++ src/sys/dev/hea/eni_if.c Mon Nov 23 06:53:21 1998
@@ -215,7 +215,7 @@
/*
* Copy interface name into response structure
*/
- if ( err = copyout ( ifname, avr->avsp_intf, IFNAMSIZ ) )
+ if ( (err = copyout ( ifname, avr->avsp_intf, IFNAMSIZ )) )
break;
/*
@@ -238,8 +238,8 @@
* Copy stats into user's buffer. Return value is
* amount of data copied.
*/
- if ( err = copyout ((void *)&eup->eu_stats, buf,
- count))
+ if ( (err = copyout ((void *)&eup->eu_stats, buf,
+ count)))
break;
buf += count;
buf_len -= count;
@@ -249,7 +249,7 @@
/*
* Record amount we're returning as vendor info...
*/
- if (err = copyout(&count, &avr->avsp_len, sizeof(int)))
+ if ((err = copyout(&count, &avr->avsp_len, sizeof(int))))
break;
/*
--- src/sys/dev/hea/eni_receive.c.old Mon Nov 23 06:53:51 1998
+++ src/sys/dev/hea/eni_receive.c Mon Nov 23 07:20:39 1998
@@ -114,8 +114,8 @@
* VCC into TRASH mode.
*/
if ( ( vci_hdr & VCI_IN_SERVICE ) == 0 ||
- ( vci_hdr & ~VCI_MODE_MASK ==
- VCI_MODE_TRASH << VCI_MODE_SHIFT ) )
+ ( vci_hdr & (~VCI_MODE_MASK ==
+ VCI_MODE_TRASH << VCI_MODE_SHIFT) ) )
goto next_vcc;
/*
--- src/sys/dev/hea/eni_transmit.c.old Mon Nov 23 06:56:03 1998
+++ src/sys/dev/hea/eni_transmit.c Mon Nov 23 06:57:45 1998
@@ -463,7 +463,7 @@
* Get start of data onto full-word alignment
*/
KB_DATASTART ( m, cp, caddr_t );
- if ( align = ((u_int)cp) & (sizeof(u_long)-1)) {
+ if ( (align = ((u_int)cp) & (sizeof(u_long)-1))) {
/*
* Gotta slide the data up
*/
@@ -622,7 +622,7 @@
* AAL5 PDUs need an extra two words for control/length and
* CRC. Check for AAL5 and add requirements here.
*/
- if (aal5 = (evp->ev_connvc->cvc_attr.aal.type == ATM_AAL5))
+ if ((aal5 = (evp->ev_connvc->cvc_attr.aal.type == ATM_AAL5)))
size = pdulen + 2 * sizeof(long);
else
size = pdulen;
--- src/sys/dev/hfa/fore_buffer.c.old Mon Nov 23 06:58:20 1998
+++ src/sys/dev/hfa/fore_buffer.c Mon Nov 23 06:59:19 1998
@@ -690,7 +690,7 @@
/*
* Run through Strategy 1 Small queue
*/
- while (bhp = Q_HEAD(fup->fu_buf1s_bq, Buf_handle)) {
+ while ((bhp = Q_HEAD(fup->fu_buf1s_bq, Buf_handle))) {
caddr_t cp;
/*
@@ -712,7 +712,7 @@
/*
* Run through Strategy 1 Large queue
*/
- while (bhp = Q_HEAD(fup->fu_buf1l_bq, Buf_handle)) {
+ while ((bhp = Q_HEAD(fup->fu_buf1l_bq, Buf_handle))) {
caddr_t cp;
/*
--- src/sys/dev/hfa/fore_if.c.old Mon Nov 23 06:59:58 1998
+++ src/sys/dev/hfa/fore_if.c Mon Nov 23 07:01:19 1998
@@ -106,7 +106,7 @@
/*
* Copy interface name into response structure
*/
- if ( err = copyout ( ifname, avr->avsp_intf, IFNAMSIZ ) )
+ if ( (err = copyout ( ifname, avr->avsp_intf, IFNAMSIZ )) )
break;
/*
@@ -131,7 +131,7 @@
* Copy stats into user's buffer. Return value is
* amount of data copied.
*/
- if (err = copyout((caddr_t)fup->fu_stats, buf, count))
+ if ((err = copyout((caddr_t)fup->fu_stats, buf, count)))
break;
buf += count;
buf_len -= count;
@@ -142,7 +142,7 @@
/*
* Record amount we're returning as vendor info...
*/
- if (err = copyout(&count, &avr->avsp_len, sizeof(int)))
+ if ((err = copyout(&count, &avr->avsp_len, sizeof(int))))
break;
/*
--- src/sys/dev/hfa/fore_output.c.old Mon Nov 23 07:01:43 1998
+++ src/sys/dev/hfa/fore_output.c Mon Nov 23 07:02:15 1998
@@ -301,7 +301,7 @@
* Get start of data onto full-word alignment
*/
KB_DATASTART(m, cp, caddr_t);
- if (align = ((u_int)cp) & (XMIT_SEG_ALIGN - 1)) {
+ if ((align = ((u_int)cp) & (XMIT_SEG_ALIGN - 1))) {
/*
* Gotta slide the data up
*/
--- src/sys/dev/pdq/pdq.c.old Mon Nov 23 07:02:38 1998
+++ src/sys/dev/pdq/pdq.c Mon Nov 23 07:05:54 1998
@@ -764,7 +764,7 @@
dataptr[PDQ_RX_FC_OFFSET+5],
dataptr[PDQ_RX_FC_OFFSET+6]);
/* rx->rx_badcrc++; */
- } else if (status.rxs_fsc == 0 | status.rxs_fsb_e == 1) {
+ } else if ((status.rxs_fsc == 0) | (status.rxs_fsb_e == 1)) {
/* rx->rx_frame_status_errors++; */
} else {
/* hardware fault */
--- src/sys/dev/ppbus/ppb_base.c.old Mon Nov 23 07:06:42 1998
+++ src/sys/dev/ppbus/ppb_base.c Mon Nov 23 07:07:29 1998
@@ -87,7 +87,7 @@
case PPB_INTR:
default:
/* wait 10 ms */
- if ((error = tsleep((caddr_t)dev, PPBPRI | PCATCH,
+ if ((error = tsleep((caddr_t)dev, (PPBPRI | PCATCH),
"ppbpoll", hz/100)))
return (error);
break;
--- src/sys/dev/ppbus/ppbconf.c.old Mon Nov 23 07:08:15 1998
+++ src/sys/dev/ppbus/ppbconf.c Mon Nov 23 07:08:53 1998
@@ -390,7 +390,7 @@
switch (how) {
case (PPB_WAIT | PPB_INTR):
- error = tsleep(ppb, PPBPRI|PCATCH, "ppbreq", 0);
+ error = tsleep(ppb, (PPBPRI|PCATCH), "ppbreq", 0);
break;
case (PPB_WAIT | PPB_NOINTR):
--- src/sys/dev/smbus/smbconf.c.old Mon Nov 23 07:09:35 1998
+++ src/sys/dev/smbus/smbconf.c Mon Nov 23 07:10:03 1998
@@ -78,7 +78,7 @@
switch (how) {
case (SMB_WAIT | SMB_INTR):
- error = tsleep(sc, SMBPRI|PCATCH, "smbreq", 0);
+ error = tsleep(sc, (SMBPRI|PCATCH), "smbreq", 0);
break;
case (SMB_WAIT | SMB_NOINTR):
--- src/sys/dev/iicbus/iiconf.c.old Mon Nov 23 07:10:51 1998
+++ src/sys/dev/iicbus/iiconf.c Mon Nov 23 07:11:07 1998
@@ -78,7 +78,7 @@
switch (how) {
case (IIC_WAIT | IIC_INTR):
- error = tsleep(sc, IICPRI|PCATCH, "iicreq", 0);
+ error = tsleep(sc, (IICPRI|PCATCH), "iicreq", 0);
break;
case (IIC_WAIT | IIC_NOINTR):
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811231336.HAA12196>
