Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5672179ybv; Tue, 18 Feb 2020 01:44:19 -0800 (PST) X-Google-Smtp-Source: APXvYqxnqLo5EipDDSRM1Y3eXt7mR9ggBkLHkrIfmq5mQtncfDPc73/R5JLXsE24z8IGc21grngK X-Received: by 2002:a05:6808:8d5:: with SMTP id k21mr680084oij.121.1582019059568; Tue, 18 Feb 2020 01:44:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582019059; cv=none; d=google.com; s=arc-20160816; b=u9EtI0sWeXm18zegkWDNFH1vrQFjXD0OZJAVkFLPHX/IPVik7txkkync/x0V4Ll032 pTUhyJ0i0MVKYhjOZjy9rMWIL6XB8rnqKVCCA/QV9+cOkoB7siyJ7XQs+iCWSV8LXHo3 j0h3ibjecl0LU6Pxst3ck2hR5kp5qbI04NHlhRHfYTazHbmGDUp8tpvqc319OUyHH0Ha kdZP6EwSwgpVKnJKnc8efULpOHHE1J5jbwPSpsOzkaQkDXZe/3hVcRxNi9ZWv5PzCRP9 6mYLyoqQfU7HgrCnuUNnWjDhcNkOU0ec1aUzDF9fgbSP44luPWI34waBrTbzXUEF9EXZ 2ONw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=waac/W6URRBuGIR7jL67/WOXUw483M/6QXKK8+dDCbU=; b=OZ/gcdN7c9NjwcJ6qaz3LX14D1X8pBUBO1IFgooyIO15pRvncASDSDkTIs4lzXFx3S pBpo/hYym1Wd16Ya/38jN73RoUFpy+3jKcHudfJaXZ/zScfV3Wq/q2kjuxEjQp3kGcAA qz43TpBe570uQ9tqcuQlk260+hQtdaHa7SHGT6LEBj1RmO3YV0YDLmXT3qUtkcTk25A7 jyc/fIFfgyOQ9oadAHVDRkkGSE6gxjt0tpTPsU0ibrO2ebOMVoB9DpX8/YDAH6QU6Fcp ov/n/qZu9nb4oDycMT2mR2KiEAocEH7p7quVHssvnHmmbDZ0ZGVebouyvJ5uK1RBp7Wm 8ZPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=Fsu1Sr51; 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 w17si7073973oiw.127.2020.02.18.01.44.07; Tue, 18 Feb 2020 01:44:19 -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; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=Fsu1Sr51; 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 S1726380AbgBRJm7 (ORCPT + 99 others); Tue, 18 Feb 2020 04:42:59 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:36800 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726199AbgBRJm7 (ORCPT ); Tue, 18 Feb 2020 04:42:59 -0500 Received: by mail-wr1-f65.google.com with SMTP id z3so23099169wru.3 for ; Tue, 18 Feb 2020 01:42:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=waac/W6URRBuGIR7jL67/WOXUw483M/6QXKK8+dDCbU=; b=Fsu1Sr51tqbL1dgNFsyf3MMny9okBD14oykYFEJfQFdXTZQsO1IFrmkF75+LNto+Ya sdpS+Ohl9w6zxtlaL+hQIbbIEqjLu2kAXe2kPJ6JtbtdhUKEFfeHNKWHR5VeLC4k0LiM g7OVG//ibmuyjpiFwJ3MRgQ3hcNysQjLPqKENz1h9fzPhqvHrOJqlaFj1yWMYriPzn6A WSVPZcLW1eLqZSXyP6M288Gpi9/QM1kvXnnyeVlUxqyQlv0Eni2c+NWAPl/e3caO+dg4 OHkep5YDgOAHHaqBQ+lOF0U8NvqEy9jaOXIqoo/1ZfEMqyuGILvFP1/OUDqDeQlL0ZbA pkpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=waac/W6URRBuGIR7jL67/WOXUw483M/6QXKK8+dDCbU=; b=tz1pG9Jyft9G/ELhYIBorr+KVvLqXjAF07NAGDnoW0R9ke6AVs472NNKJ8n+1nmieU ARP42S/tQQ3NYqXAFpYh8obJi7tW2O1rUzxg4xAlITdUeEVljFpkVYlnk7SG9V3kgxoA UXJjBDMtstZgh8OLWPMd3DJniR1ULRkZcBQIxFNO5QwNMR9b67HQ1r7FjNFa5tWRe8Hu cSNlP6Wa0TYfC7dxbugFPFe2s+cQoUNW3MMbLYBD45rWe8+SNxlHmvLs3BxWUY5SWyfK fgUmFxYpx1/nb4QrtVom+OtqBMMXI2PWy6SqUJwPfnV6kStg/YS5Db2xGWSAmPEmccgL buOg== X-Gm-Message-State: APjAAAXIk4YriLG748ozVh5A/+SoFn1RNyPfUg09foseBJnDt82h3kEn er6zEZB17zPfGQITFH87CXfCgQ== X-Received: by 2002:a05:6000:367:: with SMTP id f7mr27385763wrf.174.1582018976653; Tue, 18 Feb 2020 01:42:56 -0800 (PST) Received: from localhost.localdomain (lfbn-nic-1-188-94.w2-15.abo.wanadoo.fr. [2.15.37.94]) by smtp.gmail.com with ESMTPSA id s23sm5351095wra.15.2020.02.18.01.42.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Feb 2020 01:42:55 -0800 (PST) From: Bartosz Golaszewski To: Linus Walleij , Srinivas Kandagatla , Khouloud Touil , Geert Uytterhoeven Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 0/7] nvmem/gpio: fix resource management Date: Tue, 18 Feb 2020 10:42:27 +0100 Message-Id: <20200218094234.23896-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bartosz Golaszewski This series addresses a couple problems with memory management in nvmem core. First we fix two earlier memory leaks - this is obvious stable material. Next we extend the GPIO framework to use reference counting for GPIO descriptors. We then use it to fix the resource management problem with the write-protect pin. Finally we add some readability tweaks. While the memory leak with wp-gpios is now in mainline - I'm not sure how to go about applying the kref patch. This is theoretically a new feature but it's also the cleanest way of fixing the problem. v1 -> v2: - make gpiod_ref() helper return - reorganize the series for easier merging - fix another memory leak Bartosz Golaszewski (6): nvmem: fix memory leak in error path nvmem: fix another memory leak in error path gpiolib: use kref in gpio_desc nvmem: increase the reference count of a gpio passed over config nvmem: remove a stray newline in nvmem_register() nvmem: add a newline for readability Khouloud Touil (1): nvmem: release the write-protect pin drivers/gpio/gpiolib.c | 30 +++++++++++++++++++++++++++--- drivers/gpio/gpiolib.h | 1 + drivers/nvmem/core.c | 18 +++++++++++------- include/linux/gpio/consumer.h | 1 + 4 files changed, 40 insertions(+), 10 deletions(-) -- 2.25.0