Use MIN()/MAX() macros from sys/param.h.

Reviewed by:	grehan
Differential Revision:	https://reviews.freebsd.org/D6054
This commit is contained in:
Marcelo Araujo 2016-04-22 06:25:32 +00:00
parent 61cfb5db60
commit 59c895f143
2 changed files with 3 additions and 3 deletions

View File

@ -348,7 +348,7 @@ fwctl_request_data(uint32_t value)
/* Make sure remaining size is >= 0 */
rinfo.req_size -= sizeof(uint32_t);
remlen = (rinfo.req_size > 0) ? rinfo.req_size: 0;
remlen = MAX(rinfo.req_size, 0);
(*rinfo.req_op->op_data)(value, remlen);

View File

@ -741,7 +741,7 @@ read_prdt(struct ahci_port *p, int slot, uint8_t *cfis,
dbcsz = (prdt->dbc & DBCMASK) + 1;
ptr = paddr_guest2host(ahci_ctx(p->pr_sc), prdt->dba, dbcsz);
sublen = len < dbcsz ? len : dbcsz;
sublen = MIN(len, dbcsz);
memcpy(to, ptr, sublen);
len -= sublen;
to += sublen;
@ -847,7 +847,7 @@ write_prdt(struct ahci_port *p, int slot, uint8_t *cfis,
dbcsz = (prdt->dbc & DBCMASK) + 1;
ptr = paddr_guest2host(ahci_ctx(p->pr_sc), prdt->dba, dbcsz);
sublen = len < dbcsz ? len : dbcsz;
sublen = MIN(len, dbcsz);
memcpy(ptr, from, sublen);
len -= sublen;
from += sublen;