svn commit: r259146 - projects/altix2/sys/kern
Marcel Moolenaar
marcel at FreeBSD.org
Mon Dec 9 23:53:48 UTC 2013
Author: marcel
Date: Mon Dec 9 23:53:47 2013
New Revision: 259146
URL: http://svnweb.freebsd.org/changeset/base/259146
Log:
Process the flags (by calling _busdma_flags), after we did some
sanity checking on the arguments.
Modified:
projects/altix2/sys/kern/subr_busdma.c
Modified: projects/altix2/sys/kern/subr_busdma.c
==============================================================================
--- projects/altix2/sys/kern/subr_busdma.c Mon Dec 9 23:33:57 2013 (r259145)
+++ projects/altix2/sys/kern/subr_busdma.c Mon Dec 9 23:53:47 2013 (r259146)
@@ -558,11 +558,11 @@ busdma_tag_create(device_t dev, bus_addr
CTR5(KTR_BUSDMA, "%s: maxsz=%#jx, nsegs=%u, maxsegsz=%#jx, flags=%#x",
__func__, maxsz, nsegs, (uintmax_t)maxsegsz, flags);
- flags = _busdma_flags(__func__, dev, flags);
-
if (dev == NULL || tag_p == NULL)
return (EINVAL);
+ flags = _busdma_flags(__func__, dev, flags);
+
base = _busdma_tag_get_base(dev);
error = _busdma_tag_make(dev, base, align, bndry, maxaddr, maxsz,
nsegs, maxsegsz, datarate, flags, &tag);
@@ -592,11 +592,11 @@ busdma_tag_derive(struct busdma_tag *bas
CTR5(KTR_BUSDMA, "%s: maxsz=%#jx, nsegs=%u, maxsegsz=%#jx, flags=%#x",
__func__, maxsz, nsegs, (uintmax_t)maxsegsz, flags);
- flags = _busdma_flags(__func__, base->dt_device, flags);
-
if (base == NULL || tag_p == NULL)
return (EINVAL);
+ flags = _busdma_flags(__func__, base->dt_device, flags);
+
error = _busdma_tag_make(base->dt_device, base, align, bndry, maxaddr,
maxsz, nsegs, maxsegsz, datarate, flags, &tag);
if (error != 0)
@@ -659,11 +659,11 @@ busdma_md_create(struct busdma_tag *tag,
CTR3(KTR_BUSDMA, "%s: tag=%p, flags=%#x", __func__, tag, flags);
- flags = _busdma_flags(__func__, tag->dt_device, flags);
-
if (tag == NULL || md_p == NULL)
return (EINVAL);
+ flags = _busdma_flags(__func__, tag->dt_device, flags);
+
md = _busdma_md_create(tag, 0);
if (md == NULL)
return (ENOMEM);
@@ -817,11 +817,11 @@ busdma_md_load_ccb(busdma_md_t md, union
CTR6(KTR_BUSDMA, "%s: md=%p, ccb=%p, cb=%p, arg=%p, flags=%#x",
__func__, md, ccb, cb, arg, flags);
- flags = _busdma_flags(__func__, md->md_tag->dt_device, flags);
-
if (md == NULL || ccb == NULL)
return (EINVAL);
+ flags = _busdma_flags(__func__, md->md_tag->dt_device, flags);
+
ccb_h = &ccb->ccb_h;
if ((ccb_h->flags & CAM_DIR_MASK) == CAM_DIR_NONE) {
if (cb != NULL)
@@ -880,11 +880,11 @@ busdma_md_load_linear(struct busdma_md *
CTR6(KTR_BUSDMA, "busdma_md_load_linear: md=%p, buf=%p, len=%zu, "
"cb=%p, arg=%p, flags=%#x", md, buf, len, cb, arg, flags);
- flags = _busdma_flags(__func__, md->md_tag->dt_device, flags);
-
if (md == NULL || buf == NULL || len == 0)
return (EINVAL);
+ flags = _busdma_flags(__func__, md->md_tag->dt_device, flags);
+
error = _busdma_md_load(md, NULL, (uintptr_t)buf, len);
if (!error) {
error = _busdma_iommu_map(md->md_tag->dt_device, md);
@@ -906,11 +906,11 @@ busdma_md_load_mbuf(struct busdma_md *md
CTR6(KTR_BUSDMA, "%s: md=%p, m0=%p, cb=%p, arg=%p, flags=%#x",
__func__, md, m0, cb, arg, flags);
- flags = _busdma_flags(__func__, md->md_tag->dt_device, flags);
-
if (md == NULL || m0 == NULL)
return (EINVAL);
+ flags = _busdma_flags(__func__, md->md_tag->dt_device, flags);
+
error = 0;
for (m = m0; m != NULL && error == 0; m = m->m_next) {
if (m->m_len == 0)
@@ -1002,11 +1002,11 @@ busdma_mem_alloc(struct busdma_tag *tag,
CTR3(KTR_BUSDMA, "%s: tag=%p, flags=%#x", __func__, tag, flags);
- flags = _busdma_flags(__func__, tag->dt_device, flags);
-
if (tag == NULL || md_p == NULL)
return (EINVAL);
+ flags = _busdma_flags(__func__, tag->dt_device, flags);
+
md = _busdma_md_create(tag, BUSDMA_MD_FLAG_ALLOCATED);
if (md == NULL)
return (ENOMEM);
More information about the svn-src-projects
mailing list