Received: by 10.223.185.116 with SMTP id b49csp6426422wrg; Wed, 28 Feb 2018 09:12:22 -0800 (PST) X-Google-Smtp-Source: AH8x224TPzqyzMZQvUIcHLFOToRuQqCCgVitw6VD38qH7SQhdsLnxs2otqiIx3ZEi8F/I1y1NrSa X-Received: by 10.99.63.139 with SMTP id m133mr14638624pga.174.1519837941983; Wed, 28 Feb 2018 09:12:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519837941; cv=none; d=google.com; s=arc-20160816; b=BTlllKVl3M4JAxeUSqcdyCpBSzyxafcK22QEt6URNx8e7wiGOcU2i4TIgJIuzeqSMm DCyqkVDg/ugFltXsc/35Wi5W4PkkdgFU9AOXoo3iIBDlM2nYaX+8A/y/hSYvDXcXgeIK QhHnLVxdKKFSSwKLzyXQYM/1fQIbmGVflgmdcYAKsMTo2iVBhp/odK0q27jF4zGf7yEf UG3FYeMX5n0pPfpQFAiy5d+bywR+gn0/fZzNZW+68O1rfOqGMQAr4FYdN7OBL8MNmRGj PcUBv/vtLxHcQcfWZNLeLk2UaTaYtirgcmKsWUVehI8h6vP2hnWd6KB056eZirBXDBZy AlxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=cNlXGYOR6ycqjetGvv5skkCsSISIcEaCxM5+RJyphZ8=; b=yTO7F5g5q18B5ZqmkhY84FihlgXvJ/qXaepYtQrIQToRiQLJwTbJ5t08VBx2toSe5X HYshKxTjxC5QfZCJ87fIVmJihk0O2myi/WQh/3Y6Xo5El0pfLmbqNd0g7V5vnpqeD36N cZUDVbHsSJUx8R8kVBOrDLRhN6ZJMbtbKHxfI0cg4VexItIcqQcw4zhViv5GPSGxwMeT vlRknOoLbXiOY70u3Q/3WovnUcY1WrDPCUz0s7LMUJw8wAh2n2u1WBOwFdti/rzqVU0J 8n+HVb9AM/HgS010hd0HECSeuvzwV8kiZNYCS9X7IFfACxflh71Ylb09FFzBvIIhzYFR peQA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l30-v6si1086800plg.346.2018.02.28.09.12.07; Wed, 28 Feb 2018 09:12:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933668AbeB1RKs (ORCPT + 99 others); Wed, 28 Feb 2018 12:10:48 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34292 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933279AbeB1Pt5 (ORCPT ); Wed, 28 Feb 2018 10:49:57 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yo-0006XW-AT; Wed, 28 Feb 2018 15:22:26 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yk-0000HJ-6e; Wed, 28 Feb 2018 15:22:22 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Wolfram Sang" , "Lixin Wang" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 216/254] i2c: core: decrease reference count of device node in i2c_unregister_device In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Lixin Wang commit e0638fa400eaccf9fa8060f67140264c4e276552 upstream. Reference count of device node was increased in of_i2c_register_device, but without decreasing it in i2c_unregister_device. Then the added device node will never be released. Fix this by adding the of_node_put. Signed-off-by: Lixin Wang Tested-by: Wolfram Sang Signed-off-by: Wolfram Sang [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- drivers/i2c/i2c-core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -740,6 +740,10 @@ EXPORT_SYMBOL_GPL(i2c_new_device); */ void i2c_unregister_device(struct i2c_client *client) { + if (client->dev.of_node) { + of_node_put(client->dev.of_node); + } + device_unregister(&client->dev); } EXPORT_SYMBOL_GPL(i2c_unregister_device);