Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Nov 2017 08:37:06 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325533 - head/sys/compat/linuxkpi/common/include/linux
Message-ID:  <201711080837.vA88b6V8055182@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Wed Nov  8 08:37:05 2017
New Revision: 325533
URL: https://svnweb.freebsd.org/changeset/base/325533

Log:
  Make the dma_alloc_coherent() function in the LinuxKPI NULL safe with regard
  to the "dev" argument.
  
  Submitted by:	Krishnamraju Eraparaju @ Chelsio
  Sponsored by:	Chelsio Communications
  MFC after:	1 week

Modified:
  head/sys/compat/linuxkpi/common/include/linux/dma-mapping.h

Modified: head/sys/compat/linuxkpi/common/include/linux/dma-mapping.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/dma-mapping.h	Wed Nov  8 08:21:17 2017	(r325532)
+++ head/sys/compat/linuxkpi/common/include/linux/dma-mapping.h	Wed Nov  8 08:37:05 2017	(r325533)
@@ -127,7 +127,7 @@ dma_alloc_coherent(struct device *dev, size_t size, dm
 	size_t align;
 	void *mem;
 
-	if (dev->dma_mask)
+	if (dev != NULL && dev->dma_mask)
 		high = *dev->dma_mask;
 	else if (flag & GFP_DMA32)
 		high = BUS_SPACE_MAXADDR_32BIT;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711080837.vA88b6V8055182>