From owner-svn-src-all@FreeBSD.ORG Fri May 4 22:54:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 754341065701; Fri, 4 May 2012 22:54:55 +0000 (UTC) (envelope-from ambrisko@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 476BD8FC17; Fri, 4 May 2012 22:54:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q44Mstof026558; Fri, 4 May 2012 22:54:55 GMT (envelope-from ambrisko@svn.freebsd.org) Received: (from ambrisko@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q44MstHO026556; Fri, 4 May 2012 22:54:55 GMT (envelope-from ambrisko@svn.freebsd.org) Message-Id: <201205042254.q44MstHO026556@svn.freebsd.org> From: Doug Ambrisko Date: Fri, 4 May 2012 22:54:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235040 - head/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 May 2012 22:54:55 -0000 Author: ambrisko Date: Fri May 4 22:54:54 2012 New Revision: 235040 URL: http://svn.freebsd.org/changeset/base/235040 Log: Fix the returns in mfi_tbolt_sync_map_info. I forgot to change them to cleanup and goto out when acknowledging the LD's. Check for failure on malloc. Remove a couple of extra lines and remove the spurious return. Prompted by: Petr Lampa MFC after: 3 days Modified: head/sys/dev/mfi/mfi_tbolt.c Modified: head/sys/dev/mfi/mfi_tbolt.c ============================================================================== --- head/sys/dev/mfi/mfi_tbolt.c Fri May 4 22:48:44 2012 (r235039) +++ head/sys/dev/mfi/mfi_tbolt.c Fri May 4 22:54:54 2012 (r235040) @@ -1290,7 +1290,6 @@ mfi_process_fw_state_chg_isr(void *arg) mtx_unlock(&sc->mfi_io_lock); } - /* * The ThunderBolt HW has an option for the driver to directly * access the underlying disks and operate on the RAID. To @@ -1362,13 +1361,21 @@ mfi_tbolt_sync_map_info(struct mfi_softc mtx_unlock(&sc->mfi_io_lock); ld_sync = (union mfi_ld_ref *) malloc(ld_size, M_MFIBUF, M_WAITOK | M_ZERO); + if (ld_sync == NULL) { + device_printf(sc->mfi_dev, "Failed to allocate sync\n"); + goto out; + } for (i = 0; i < list->ld_count; i++) { ld_sync[i].ref = list->ld_list[i].ld.ref; } mtx_lock(&sc->mfi_io_lock); - if ((cmd = mfi_dequeue_free(sc)) == NULL) - return; + if ((cmd = mfi_dequeue_free(sc)) == NULL) { + device_printf(sc->mfi_dev, "Failed to get command\n"); + free(ld_sync, M_MFIBUF); + goto out; + } + context = cmd->cm_frame->header.context; bzero(cmd->cm_frame, sizeof(union mfi_frame)); cmd->cm_frame->header.context = context; @@ -1396,7 +1403,10 @@ mfi_tbolt_sync_map_info(struct mfi_softc if ((error = mfi_mapcmd(sc, cmd)) != 0) { device_printf(sc->mfi_dev, "failed to send map sync\n"); - return; + free(ld_sync, M_MFIBUF); + sc->mfi_map_sync_cm = NULL; + mfi_requeue_ready(cmd); + goto out; } out: @@ -1405,11 +1415,8 @@ out: if (cm) mfi_release_command(cm); mtx_unlock(&sc->mfi_io_lock); - - return; } - static void mfi_sync_map_complete(struct mfi_command *cm) {