Use MIN()/MAX() macros from sys/param.h.
Reviewed by: grehan Differential Revision: https://reviews.freebsd.org/D6054
This commit is contained in:
parent
61cfb5db60
commit
59c895f143
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user