From patchwork Thu Jun 15 18:25:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Greer X-Patchwork-Id: 9789813 X-Patchwork-Delegate: sameo@linux.intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F0C2160325 for ; Thu, 15 Jun 2017 18:26:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA6072861E for ; Thu, 15 Jun 2017 18:26:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF4472862C; Thu, 15 Jun 2017 18:26:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93F672861E for ; Thu, 15 Jun 2017 18:26:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752521AbdFOS0T (ORCPT ); Thu, 15 Jun 2017 14:26:19 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:40987 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753181AbdFOSZa (ORCPT ); Thu, 15 Jun 2017 14:25:30 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 3E69C20A85; Thu, 15 Jun 2017 14:25:19 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Thu, 15 Jun 2017 14:25:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=animalcreek.com; h=cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=tJm 3rU/v/VnuWFARNewqwTEZFy9/E2DZMYUafUZOatk=; b=MFfq6rkBPXihGH95mTa ReGFFpZABWQXRMio/c2CBKIKY85IDtsxnU+3WGjuC3U4rWhoNeb98QN80OSLRa+l IGAvL8u3mxNDHbQPrns0jRcyq5x0zlBNyfHTLxT5IK4MvqLoFYvjLxFJj+PZ31Db sinLDY+sTmo9fk08Whb4iZLo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=tJm3rU/v/VnuWFARNewqwTEZFy9/E2DZMYUafUZOa tk=; b=o5gz/BYqbe9WDYfidgIdtuyWPgIMW2ZonWLXM1LKoWoUzR0lvo2B3Tl+o g2MVeRoxU16krr7cUbblliPVSW6c8IRhttQqYTFrHpu514yEvHOPqshREpHitN37 YAJSlrEP0fl4G999+9eIl2anFIRsNJvAm22dnFFsk7+v0BqjXSkmyldL4TY6Xewk CMk8b3u6JgGzrtgrCYHzwpD8i4zShtDCZpb5g9ZxO8YZ2R99WctBOMnbfA7rp9WI pTrYEEhocLtS/uS0FxQOsp/vRpQ1282ctN2oGQ53IY4Nw5RRLB+mlNQMVrU0be75 Pb2RDaKSqhfsG7DMzH0UaXDTz7Y6g== X-ME-Sender: X-Sasl-enc: cu4DPYUAvhBtG4KmzYeOfZb1iq2kolhSpAZ35Boh6pK9 1497551118 Received: from blue.animalcreek.com (ip68-2-81-12.ph.ph.cox.net [68.2.81.12]) by mail.messagingengine.com (Postfix) with ESMTPA id E9CA97E98B; Thu, 15 Jun 2017 14:25:18 -0400 (EDT) Received: from blue.animalcreek.com (localhost [127.0.0.1]) by blue.animalcreek.com (Postfix) with ESMTP id D1D9BA2056E; Thu, 15 Jun 2017 11:25:17 -0700 (MST) From: Mark Greer To: Samuel Ortiz Cc: linux-wireless@vger.kernel.org, linux-nfc@lists.01.org, Mark Greer Subject: [PATCH 10/23] adapter: Clear timer handle when DEP timer stopped Date: Thu, 15 Jun 2017 11:25:03 -0700 Message-Id: <20170615182516.4508-11-mgreer@animalcreek.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170615182516.4508-1-mgreer@animalcreek.com> References: <20170615182516.4508-1-mgreer@animalcreek.com> Organization: Animal Creek Technologies, Inc. Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP __near_adapter_set_dep_state() stops the neard DEP timer but doesn't clear the timer handle. This can cause neard to try to stop the timer when it isn't running. To fix that, clear the handle so neard doesn't try to stop an already stopped timer. Signed-off-by: Mark Greer --- src/adapter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/adapter.c b/src/adapter.c index 7be87e2..eb1a407 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -615,8 +615,10 @@ int __near_adapter_set_dep_state(uint32_t idx, bool dep) target_idx = __neard_device_get_idx(adapter->device_link); __near_adapter_remove_target(idx, target_idx); } else { - if (adapter->dep_timer > 0) + if (adapter->dep_timer > 0) { g_source_remove(adapter->dep_timer); + adapter->dep_timer = 0; + } if (!__near_device_register_interface(adapter->device_link)) return -ENODEV;