From owner-svn-soc-all@freebsd.org Sun Jun 26 10:27:18 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E000DA79A8D for ; Sun, 26 Jun 2016 10:27:18 +0000 (UTC) (envelope-from iateaca@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D3AA31B24 for ; Sun, 26 Jun 2016 10:27:18 +0000 (UTC) (envelope-from iateaca@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5QARI63070639 for ; Sun, 26 Jun 2016 10:27:18 GMT (envelope-from iateaca@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5QARID9070636 for svn-soc-all@FreeBSD.org; Sun, 26 Jun 2016 10:27:18 GMT (envelope-from iateaca@FreeBSD.org) Date: Sun, 26 Jun 2016 10:27:18 GMT Message-Id: <201606261027.u5QARID9070636@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to iateaca@FreeBSD.org using -f From: iateaca@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305555 - soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jun 2016 10:27:19 -0000 Author: iateaca Date: Sun Jun 26 10:27:17 2016 New Revision: 305555 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305555 Log: check the audio context is initialized when try to start it M bhyve/hda_codec.c Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c ============================================================================== --- soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c Sun Jun 26 00:53:31 2016 (r305554) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c Sun Jun 26 10:27:17 2016 (r305555) @@ -78,6 +78,7 @@ typedef int (*setup_func_t)(void *arg); struct hda_audio_ctxt { + uint8_t started; char name[64]; uint8_t run; pthread_t tid; @@ -389,6 +390,8 @@ { uint8_t div = 0; + assert(params); + /* Compute the Sample Rate */ params->rate = (fmt & HDA_CODEC_FMT_BASE_MASK) ? 44100 : 48000; @@ -568,6 +571,8 @@ pthread_set_name_np(actx->tid, tname); assert(!err); + actx->started = 1; + return 0; } @@ -576,6 +581,9 @@ { int err = 0; + assert(actx); + assert(actx->started); + /* The stream is supposed to be stopped */ if (actx->run) return -1;