svn commit: r250683 - stable/9/sys/dev/bktr

Sergey Kandaurov pluknet at FreeBSD.org
Wed May 15 21:35:23 UTC 2013


Author: pluknet
Date: Wed May 15 21:35:22 2013
New Revision: 250683
URL: http://svnweb.freebsd.org/changeset/base/250683

Log:
  MFC r250088:
    Pass a format string to kproc_create() [1] and thus fix the build with
    -DBKTR_NEW_MSP34XX_DRIVER and -Wformat-security.

Modified:
  stable/9/sys/dev/bktr/msp34xx.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/bktr/msp34xx.c
==============================================================================
--- stable/9/sys/dev/bktr/msp34xx.c	Wed May 15 21:19:05 2013	(r250682)
+++ stable/9/sys/dev/bktr/msp34xx.c	Wed May 15 21:35:22 2013	(r250683)
@@ -134,7 +134,6 @@ struct msp3400c {
 
 	/* thread */
 	struct proc	    *kthread;
-	char                *threaddesc;
 
 	int                  active,restart,rmmod;
 
@@ -1147,12 +1146,6 @@ int msp_attach(bktr_ptr_t bktr)
 	msp->bass   = 32768;
 	msp->treble = 32768;
 	msp->input  = -1;
-	msp->threaddesc = malloc(15 * sizeof(char), M_DEVBUF, M_NOWAIT);
-	if (msp->threaddesc == NULL) {
-		free(msp, M_DEVBUF);
-                return ENOMEM;
-	}
-	snprintf(msp->threaddesc, 14, "%s_msp34xx_thread", bktr->bktr_xname);
 
 	for (i = 0; i < DFP_COUNT; i++)
 		msp->dfp_regs[i] = -1;
@@ -1163,7 +1156,6 @@ int msp_attach(bktr_ptr_t bktr)
 	if (-1 != rev1)
 		rev2 = msp3400c_read(bktr, I2C_MSP3400C_DFP, 0x1f);
 	if ((-1 == rev1) || (0 == rev1 && 0 == rev2)) {
-		free(msp->threaddesc, M_DEVBUF);
 		free(msp, M_DEVBUF);
 		bktr->msp3400c_info = NULL;
 		printf("%s: msp3400: error while reading chip version\n", bktr_name(bktr));
@@ -1199,10 +1191,9 @@ int msp_attach(bktr_ptr_t bktr)
 	/* startup control thread */
 	err = kproc_create(msp->simple ? msp3410d_thread : msp3400c_thread,
 			     bktr, &msp->kthread, (RFFDG | RFPROC), 0,
-			     msp->threaddesc);
+			     "%s_msp34xx_thread", bktr->bktr_xname);
 	if (err) {
 		printf("%s: Error returned by kproc_create: %d", bktr_name(bktr), err);
-		free(msp->threaddesc, M_DEVBUF);
 		free(msp, M_DEVBUF);
 		bktr->msp3400c_info = NULL;
 		return ENXIO;


More information about the svn-src-stable-9 mailing list