From patchwork Thu May 25 17:47:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: minimumlaw@rambler.ru X-Patchwork-Id: 9748845 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 2D30C601E9 for ; Thu, 25 May 2017 17:48:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E92826BE9 for ; Thu, 25 May 2017 17:48:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 133C628066; Thu, 25 May 2017 17:48:00 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 8F59326BE9 for ; Thu, 25 May 2017 17:47:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S970065AbdEYRrh (ORCPT ); Thu, 25 May 2017 13:47:37 -0400 Received: from huan4.mail.rambler.ru ([81.19.78.110]:59018 "EHLO huan4.mail.rambler.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S970064AbdEYRrf (ORCPT ); Thu, 25 May 2017 13:47:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=rambler.ru; s=mail; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=rHjZbon5E7SZAItcs4G2tgMUP1ZKPV6cxguMCUxo2r4=; b=W3QvqURXt4lfhdGtHW5J+WbtQnJOLs8cuVkcPhMPwuD4Cu3wPpUvomlzRLXAdVHRw5l07dQogEBOMlBz4RuStVOEVHg1pKvxfe3QpEMYZDnskAwpoJVo6X9+QskHq9VYfifUM7M/bKle/WZvXMaXrpyOpczBBZVJRfkpcE9RWEc=; Received: from [UNAVAILABLE] ([178.70.239.107]:18526 helo=personal.local.network) by huan4.mail.rambler.ru with esmtpa (Exim 4.76) (envelope-from ) id 1dDwrF-0007Tp-9w; Thu, 25 May 2017 20:47:33 +0300 From: "Alex A. Mihaylov" To: Mark Brown , Greg Kroah-Hartman , Sebastian Reichel , Evgeniy Polyakov , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: "Alex A. Mihaylov" Subject: [PATCH 4/4] Fix W1 slave exchange with second device on probe step Date: Thu, 25 May 2017 20:47:21 +0300 Message-Id: <20170525174721.3245-5-minimumlaw@rambler.ru> X-Mailer: git-send-email 2.8.4 (Apple Git-73) In-Reply-To: <20170525174639.3191-1-minimumlaw@rambler.ru> References: <20170525174639.3191-1-minimumlaw@rambler.ru> X-Rambler-User: minimumlaw@rambler.ru/178.70.239.107 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Alex A. Mihaylov --- drivers/w1/w1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index 90a3d93..5b8b976 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c @@ -731,6 +731,7 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn) memcpy(&sl->reg_num, rn, sizeof(sl->reg_num)); atomic_set(&sl->refcnt, 1); atomic_inc(&sl->master->refcnt); + dev->slave_count++; /* slave modules need to be loaded in a context with unlocked mutex */ mutex_unlock(&dev->mutex); @@ -750,11 +751,11 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn) sl->family = f; - err = __w1_attach_slave_device(sl); if (err < 0) { dev_err(&dev->dev, "%s: Attaching %s failed.\n", __func__, sl->name); + dev->slave_count--; w1_family_put(sl->family); atomic_dec(&sl->master->refcnt); kfree(sl); @@ -762,7 +763,6 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn) } sl->ttl = dev->slave_ttl; - dev->slave_count++; memcpy(msg.id.id, rn, sizeof(msg.id)); msg.type = W1_SLAVE_ADD;