Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Dec 2019 16:42:33 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r355333 - stable/12/sys/cam
Message-ID:  <201912031642.xB3GgXRD089746@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Tue Dec  3 16:42:32 2019
New Revision: 355333
URL: https://svnweb.freebsd.org/changeset/base/355333

Log:
  MFC r341756 (by scottl):
  Don't allocate the config_intrhook separately from the softc, it's small
  enough that it costs more code to handle the malloc/free than it saves.

Modified:
  stable/12/sys/cam/cam_xpt.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/cam_xpt.c
==============================================================================
--- stable/12/sys/cam/cam_xpt.c	Tue Dec  3 16:33:35 2019	(r355332)
+++ stable/12/sys/cam/cam_xpt.c	Tue Dec  3 16:42:32 2019	(r355333)
@@ -129,7 +129,7 @@ struct xpt_softc {
 	TAILQ_HEAD(,cam_eb)	xpt_busses;
 	u_int			bus_generation;
 
-	struct intr_config_hook	*xpt_config_hook;
+	struct intr_config_hook	xpt_config_hook;
 
 	int			boot_delay;
 	struct callout 		boot_callout;
@@ -982,17 +982,8 @@ xpt_init(void *dummy)
 	/*
 	 * Register a callback for when interrupts are enabled.
 	 */
-	xsoftc.xpt_config_hook =
-	    (struct intr_config_hook *)malloc(sizeof(struct intr_config_hook),
-					      M_CAMXPT, M_NOWAIT | M_ZERO);
-	if (xsoftc.xpt_config_hook == NULL) {
-		printf("xpt_init: Cannot malloc config hook "
-		       "- failing attach\n");
-		return (ENOMEM);
-	}
-	xsoftc.xpt_config_hook->ich_func = xpt_config;
-	if (config_intrhook_establish(xsoftc.xpt_config_hook) != 0) {
-		free (xsoftc.xpt_config_hook, M_CAMXPT);
+	xsoftc.xpt_config_hook.ich_func = xpt_config;
+	if (config_intrhook_establish(&xsoftc.xpt_config_hook) != 0) {
 		printf("xpt_init: config_intrhook_establish failed "
 		       "- failing attach\n");
 	}
@@ -5262,9 +5253,7 @@ xpt_finishconfig_task(void *context, int pending)
 		xpt_for_all_devices(xptpassannouncefunc, NULL);
 
 	/* Release our hook so that the boot can continue. */
-	config_intrhook_disestablish(xsoftc.xpt_config_hook);
-	free(xsoftc.xpt_config_hook, M_CAMXPT);
-	xsoftc.xpt_config_hook = NULL;
+	config_intrhook_disestablish(&xsoftc.xpt_config_hook);
 
 	free(context, M_CAMXPT);
 }



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