Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp201163ybt; Thu, 18 Jun 2020 23:06:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3E4bQcC5CKfkX2451KkcOpkfRXSpMMt/eG541K317M6BkRqsifvLfX301nwYWj//rNs/J X-Received: by 2002:a17:906:7c58:: with SMTP id g24mr2234212ejp.205.1592546786618; Thu, 18 Jun 2020 23:06:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592546786; cv=none; d=google.com; s=arc-20160816; b=qbKtIqUB1bS+PxfSmBTpAVdz+pMUw4hgaI0FmFXo4LUyp1Ctyp1wYmm/lf404HuTOn QjQVd0etIJ7IdjpO50BXxtZig/mZsZUJZBsJS5v6NmJVhVXcEhkkkXocsLipQv6srw5D vjAzBtZDXE5bNZchPyrAEB3UXcClG5fp2L/W2/E6VW52kWngthSw8VFQL9ZzDo3ZlwL6 JExgvEUUcjPOrTi8POz0yyt1ZFe5qMqTi4gzCRzSqbFO2YBX5gHXtUA3k9w6Vh3ODx4f zTHnSZLxcUMv1Pq7AbQJRsOV+XLZ4iEw16NW3PkoLu/ciWs3Cu83pMsdl9h/Opm/ZYkG 2h4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=zbFP4tmibuDLJJ+2gZjvmKuW9GH0ysRtmg/bK/2BQsY=; b=YlSdm+geSRu5N35eCr1xLGiyNGzyaJp5qsgQFwAai87r+//fixl9GohEuUh9G3Muhe bdjqROM9gXDA7P+k/Cu0TxuqHTpHcOzxfSljgqLUnbxdk9LgIrJaT/q1Sa2TcyP8R0gO kgFXOJ/ddAWitcyqvOap2piRqsztR1C93YClaJbvu0+xQ20wzzHDXsGnoSZIFABj4BAB 4W43vHVJraPsNpMBadG0z8m9ZZa2zv4CI0eC6t5QeL3CT92gEMkT7Gwe7xGOR6hO5Nf+ bgwkrXY3kJOTvhqzBvDXWq1U9CzjGNzkLJ+nGzimEDszO10JGy//d77m8ROL0YA24db4 WMQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u8si3251902edp.357.2020.06.18.23.06.01; Thu, 18 Jun 2020 23:06:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726382AbgFSGCS (ORCPT + 99 others); Fri, 19 Jun 2020 02:02:18 -0400 Received: from mga01.intel.com ([192.55.52.88]:62658 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727060AbgFSGCR (ORCPT ); Fri, 19 Jun 2020 02:02:17 -0400 IronPort-SDR: nkjL9Zaku2r7rx9bwAzeSBRYClOqHoQVcPGLwdbm69gdyJLYnqVB+4lNkn+ONFOjNaGT6Kl6VS PTeAALcNoE7Q== X-IronPort-AV: E=McAfee;i="6000,8403,9656"; a="160959305" X-IronPort-AV: E=Sophos;i="5.75,253,1589266800"; d="scan'208";a="160959305" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jun 2020 23:02:16 -0700 IronPort-SDR: Cri10xhoXyryAsw8EPxLQblO0+GwKcCJIGArw5xtGo1VwaIsuNSg5f00lhC9FZgy02/ylGxvb9 aM4pT+eeJ00g== X-IronPort-AV: E=Sophos;i="5.75,253,1589266800"; d="scan'208";a="299948784" Received: from han1-mobl3.jf.intel.com ([10.255.228.38]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jun 2020 23:02:16 -0700 From: tedd.an@linux.intel.com To: linux-bluetooth@vger.kernel.org Cc: Tedd Ho-Jeong An Subject: [PATCH 2/2] midi: Fix random empty timestamp_high value Date: Thu, 18 Jun 2020 23:01:53 -0700 Message-Id: <20200619060153.65114-2-tedd.an@linux.intel.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200619060153.65114-1-tedd.an@linux.intel.com> References: <20200619060153.65114-1-tedd.an@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Tedd Ho-Jeong An The timestamp_high value is assigned from the monotonic time but there is a chance that the value becomes zero becuase it reads the value between bit8 and bit13. This patch makes sure the timestamp_high value get a non-zero value. --- profiles/midi/libmidi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/profiles/midi/libmidi.c b/profiles/midi/libmidi.c index cc5f079e7..fd40b038b 100644 --- a/profiles/midi/libmidi.c +++ b/profiles/midi/libmidi.c @@ -77,8 +77,13 @@ inline static void append_timestamp_high_maybe(struct midi_write_parser *parser) if (midi_write_has_data(parser)) return; - parser->rtime = g_get_monotonic_time() / 1000; /* convert µs to ms */ - timestamp_high |= (parser->rtime & 0x1F80) >> 7; + /* Make sure timesampt_high is assigned a non-zero value */ + do { + /* convert µs to ms */ + parser->rtime = g_get_monotonic_time() / 1000; + timestamp_high |= (parser->rtime & 0x1F80) >> 7; + } while (timestamp_high == 0x80); + /* set timestampHigh */ buffer_append_byte(&parser->midi_stream, timestamp_high); } -- 2.25.4