Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5083777ybv; Mon, 17 Feb 2020 11:55:19 -0800 (PST) X-Google-Smtp-Source: APXvYqw6vb7D6OS3SGFQR/Xaom34K88OSTEfXuDK4yujtxE6I4ZQ9tj1Bmq4Qmksivk9/kVs6Xww X-Received: by 2002:aca:db41:: with SMTP id s62mr384692oig.87.1581969319079; Mon, 17 Feb 2020 11:55:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581969319; cv=none; d=google.com; s=arc-20160816; b=Lq5am3ImTeiv44Qjl9unN1ijXLnsonpUS45DnaV8Tt1q+117qKpPrJa/nEFv41JxkS Wo/ypcua668oMqZFJNJpU9k7TaQOpK054FrNJ/Cecr8UvhWOe0MnR87vr9JQDc/rZ8+X ztphNYhF1Ofpr0JDFMTVjbQCsiOkeKbPxV2/paTNi0EotT4IVioHlG9y2uqsulRET0BH 9s1S6/igr2oC1eBsbUsQikYT4VTNDIq/8mVNp2oebTBSM4rRqPb43V8sqViRmpUgivg2 X+8Idgzc35AhqEGiPiLrOyawqh81HJGBufmEk+oXp4Gr/XJbvujKdpt183NyMGPFch7y nE4A== 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=XWr9d1ajXFj1+3i5dkAdmDb2mHo0visFJ3r0UjQmCPA=; b=gaAuecSBg3QEAbjKvtC9d68vACM+evZgtpWG/b5GqpK0af1dEyZfbPat/YXPIkatsl Mx1gdSOFYSH3eqPr8uwBYDANBh7UDnx2JJH8uqD/lRWY6GVTn6/W/hvPB3hoN6c60Nnb 9QPOSQjyysriD+cSqX4Cm8sgPMSGXgSK1PrrgxRyvg2Qogm1I+P0pTpSQ8v+QuUJI8VH mkF5pIUH5aFtWVvPCJ0Hi/2aEFi7ITKUq7qhKpT1U3mAb6kBy4QqaKW4RLHZqOaFccuO zvZFL3n3I479piJG4OFPZ3laLiBzPfpVNNwB+aGcXpCM/+K4+K8DbtXCk2BB2VrSvJEJ FNFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=QU3yhGzt; 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 b21si818925ots.38.2020.02.17.11.55.07; Mon, 17 Feb 2020 11:55: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=QU3yhGzt; 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 S1729556AbgBQTyl (ORCPT + 99 others); Mon, 17 Feb 2020 14:54:41 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:46060 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727332AbgBQTyl (ORCPT ); Mon, 17 Feb 2020 14:54:41 -0500 Received: by mail-wr1-f66.google.com with SMTP id g3so21175312wrs.12 for ; Mon, 17 Feb 2020 11:54:40 -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=XWr9d1ajXFj1+3i5dkAdmDb2mHo0visFJ3r0UjQmCPA=; b=QU3yhGzt1nI2tSShwBcrtbO8PsjxVzQf42Ad56dDCNe/2PndW4x+YwT43UAD+tMgSO x/Faym00HrVbq+9y63LY2lOz9PNpw0Zu+oMhLBFrwIXpCUIvLBuuuStlmcZoBVfS5osl GpWXToShF1Ny3an8qWLn57OPAX90d4JKpJpdx9XlNU2QCMXSed8qmKC5KzhwWAHtKHjC N87eK20TEDcRLCavoSm6UIL7b3z7zWLQsBCreQsMBIkwVPmG46i3rucA19h5kSDYHmq/ 4BbMwdTaOJCVW9CINC4aq/rfRGE2eR6VpkgK4VE2/vv/3TojugIhwJULOyS4W3VIPhGW y9FQ== 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=XWr9d1ajXFj1+3i5dkAdmDb2mHo0visFJ3r0UjQmCPA=; b=ccuXPPTkepb3kGe9RhvIUnq5X3t1Tb9PXhCrLG9QDRaM2JFLlrqA8mqPoEzpkNGSWQ cq2vajdDc+X6bLhwU//o6Vn62uztpp9OlrSh6tY3EkJMVdA+5FY5RZIkA0IeBUV2A8tx fRe/um85GZJYc0trhhKYodNdZ3A6DR8joXQZC9sDqhJIaaH4N3MPyqd5JQpXZ5P+HX8N BoMcsma3sSgGDeWTQfxY+qKjXLm/NKiLGW4pzKO68RkBnp+DiR8s0iO19oPoB+uxHs1B MnCCRkPtLAYTCAqYgQGe62UxgQvn1D2X6/V78lf1/5wo9zakkplN3rDhiLUGHIOfEGPl 7shg== X-Gm-Message-State: APjAAAUu3eVq9N3cIWYcDfRPvA/XBIUsnpPK2Wk1tcWgMt8aaIG7aov5 ZhYMO5doHYDmKRyBxW/oX9lftw== X-Received: by 2002:a5d:498f:: with SMTP id r15mr23384114wrq.284.1581969279536; Mon, 17 Feb 2020 11:54:39 -0800 (PST) Received: from debian-brgl.local (8.165.185.81.rev.sfr.net. [81.185.165.8]) by smtp.gmail.com with ESMTPSA id v5sm2679469wrv.86.2020.02.17.11.54.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 11:54:39 -0800 (PST) From: Bartosz Golaszewski To: Linus Walleij , Srinivas Kandagatla , Khouloud Touil Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 0/6] nvmem/gpio: fix resource management Date: Mon, 17 Feb 2020 20:54:29 +0100 Message-Id: <20200217195435.9309-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. We fix an earlier memory leak in error path in patch 2/6. Patches 1/6, 5/6 & 6/6 add reference counting to gpio_desc structure and use it to correctly free the write-protect GPIO. Patches 3/6 & 4/6 fix newline problems. Bartosz Golaszewski (5): gpiolib: use kref in gpio_desc nvmem: fix memory leak in error path nvmem: remove a stray newline in nvmem_register() nvmem: add a newline for readability nvmem: increase the reference count of a gpio passed over config Khouloud Touil (1): nvmem: release the write-protect pin drivers/gpio/gpiolib.c | 26 +++++++++++++++++++++++--- drivers/gpio/gpiolib.h | 1 + drivers/nvmem/core.c | 14 ++++++++++---- include/linux/gpio/consumer.h | 1 + 4 files changed, 35 insertions(+), 7 deletions(-) -- 2.25.0