[FE training-materials-updates] serial-output lab: use devm_kasprintf()

Michael Opdenacker michael.opdenacker at free-electrons.com
Thu Dec 10 08:34:13 CET 2015


Repository : git://git.free-electrons.com/training-materials.git
On branch  : master
Link       : http://git.free-electrons.com/training-materials/commit/?id=609ef99f52709584c07762c982721d2a34f81cf8

>---------------------------------------------------------------

commit 609ef99f52709584c07762c982721d2a34f81cf8
Author: Michael Opdenacker <michael.opdenacker at free-electrons.com>
Date:   Thu Dec 10 08:34:13 2015 +0100

    serial-output lab: use devm_kasprintf()
    
    Signed-off-by: Michael Opdenacker <michael.opdenacker at free-electrons.com>


>---------------------------------------------------------------

609ef99f52709584c07762c982721d2a34f81cf8
 labs/kernel-serial-output/kernel-serial-output.tex | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/labs/kernel-serial-output/kernel-serial-output.tex b/labs/kernel-serial-output/kernel-serial-output.tex
index 24a68ad..0a5f323 100644
--- a/labs/kernel-serial-output/kernel-serial-output.tex
+++ b/labs/kernel-serial-output/kernel-serial-output.tex
@@ -63,11 +63,9 @@ for each found device:
 \begin{itemize}
 \item To get an automatically assigned minor number.
 \item To specify a name for the device file in {\em devtmpfs}. We
-  propose to use {\tt kasprintf(GFP\_KERNEL,
-    "feserial-\%x", res->start)}. \code{kasprintf()} allocates a buffer
-    and runs \code{ksprintf()} to fill its contents.  Don't forget to
-    call \code{kfree()} on this buffer in the \code{remove()}
-    function!
+  propose to use {\tt devm\_kasprintf(&pdev->dev, GFP\_KERNEL,
+  "feserial-\%x", res->start)}. \code{devm_kasprintf()} allocates a
+  buffer and runs \code{ksprintf()} to fill its contents.
 \item To pass the file operations structure that you defined.
 \end{itemize}
 




More information about the training-materials-updates mailing list