aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-01-26 06:27:23 -0500
committerSumit Semwal <sumit.semwal@ti.com>2012-03-19 06:12:15 -0400
commitd1aa06a1eaf5f751c9913703031d611599d8d3d7 (patch)
treedce298d9d1f7bdb95e8c259c3e304f9322c5d31a /drivers/base
parent5375764f9408b8ef1fb8d6cd1ed0efd97dce4824 (diff)
dma-buf: Remove unneeded sanity checks
ops, ops->map_dma_buf and ops->unmap_dma_buf are guaranteed to be non-NULL by a check in dma_buf_export(). Remove NULL checks on those variables in the other API functions. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/dma-buf.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/base/dma-buf.c b/drivers/base/dma-buf.c
index 965833acf0d2..198edd8a9f0a 100644
--- a/drivers/base/dma-buf.c
+++ b/drivers/base/dma-buf.c
@@ -185,7 +185,7 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
185 struct dma_buf_attachment *attach; 185 struct dma_buf_attachment *attach;
186 int ret; 186 int ret;
187 187
188 if (WARN_ON(!dmabuf || !dev || !dmabuf->ops)) 188 if (WARN_ON(!dmabuf || !dev))
189 return ERR_PTR(-EINVAL); 189 return ERR_PTR(-EINVAL);
190 190
191 attach = kzalloc(sizeof(struct dma_buf_attachment), GFP_KERNEL); 191 attach = kzalloc(sizeof(struct dma_buf_attachment), GFP_KERNEL);
@@ -224,7 +224,7 @@ EXPORT_SYMBOL_GPL(dma_buf_attach);
224 */ 224 */
225void dma_buf_detach(struct dma_buf *dmabuf, struct dma_buf_attachment *attach) 225void dma_buf_detach(struct dma_buf *dmabuf, struct dma_buf_attachment *attach)
226{ 226{
227 if (WARN_ON(!dmabuf || !attach || !dmabuf->ops)) 227 if (WARN_ON(!dmabuf || !attach))
228 return; 228 return;
229 229
230 mutex_lock(&dmabuf->lock); 230 mutex_lock(&dmabuf->lock);
@@ -255,12 +255,11 @@ struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach,
255 255
256 might_sleep(); 256 might_sleep();
257 257
258 if (WARN_ON(!attach || !attach->dmabuf || !attach->dmabuf->ops)) 258 if (WARN_ON(!attach || !attach->dmabuf))
259 return ERR_PTR(-EINVAL); 259 return ERR_PTR(-EINVAL);
260 260
261 mutex_lock(&attach->dmabuf->lock); 261 mutex_lock(&attach->dmabuf->lock);
262 if (attach->dmabuf->ops->map_dma_buf) 262 sg_table = attach->dmabuf->ops->map_dma_buf(attach, direction);
263 sg_table = attach->dmabuf->ops->map_dma_buf(attach, direction);
264 mutex_unlock(&attach->dmabuf->lock); 263 mutex_unlock(&attach->dmabuf->lock);
265 264
266 return sg_table; 265 return sg_table;
@@ -278,13 +277,11 @@ EXPORT_SYMBOL_GPL(dma_buf_map_attachment);
278void dma_buf_unmap_attachment(struct dma_buf_attachment *attach, 277void dma_buf_unmap_attachment(struct dma_buf_attachment *attach,
279 struct sg_table *sg_table) 278 struct sg_table *sg_table)
280{ 279{
281 if (WARN_ON(!attach || !attach->dmabuf || !sg_table 280 if (WARN_ON(!attach || !attach->dmabuf || !sg_table))
282 || !attach->dmabuf->ops))
283 return; 281 return;
284 282
285 mutex_lock(&attach->dmabuf->lock); 283 mutex_lock(&attach->dmabuf->lock);
286 if (attach->dmabuf->ops->unmap_dma_buf) 284 attach->dmabuf->ops->unmap_dma_buf(attach, sg_table);
287 attach->dmabuf->ops->unmap_dma_buf(attach, sg_table);
288 mutex_unlock(&attach->dmabuf->lock); 285 mutex_unlock(&attach->dmabuf->lock);
289 286
290} 287}