From patchwork Thu Feb 8 16:58:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198584 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp460196dyd; Thu, 8 Feb 2024 13:22:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUvKPQ5iVyiJtn+vlupF8+9YDN92UjCbafrWYMIm3DxF7T93NcOpIiVcl93KSqfSCJyQiUoEaYdVVNUh/00UyNS5qydcA== X-Google-Smtp-Source: AGHT+IGBdlT0IoPnyElNDpljw9Lvzst6jrXL4OZCCAyZV4cPqMBaZrAan7k8q4f6nQivJUKMCWHE X-Received: by 2002:a05:6a00:80dc:b0:6e0:6bc7:15f4 with SMTP id ei28-20020a056a0080dc00b006e06bc715f4mr474921pfb.15.1707427366520; Thu, 08 Feb 2024 13:22:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707427366; cv=pass; d=google.com; s=arc-20160816; b=b/oROD6q/uXgHV9ixh/ixgfg6L82XQSMajD47EWtNQuml1i9siNHhggmJb5MI3NWdP qTYg8OxxUOQKXc9GNTdvPrSKlyi6kgQZAIpcpEfdyMFdh4s0BSJWk1lfCBxLR+zu8fhe l6ij7tx3Ta4KzRED9GAC2GeIhVagJn4Mv8ii0JY74qKgq18/Gl1ZTsySvKiQubOnIR47 32Jevgx1KUPO1EXHkjI0c3QWW2Ol7vp7Hy6m73aw/o9akI/h7yUg1qb4uFhJZ8SSEFNJ 0mf1Am0gS+GLxj3x41Y0DLmxHbLtUIK4mBkLJrYifxa7iRtLxwwXWx8+2icp0tBm2PRk GtgQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=6+WB38byI/XswdNKZo2L4rIz6zyATe1cpxc4bxsghTg=; fh=/XZNodid6y+BTY1H+R2MoAhn8Ey162lqTm2g8mBQTS8=; b=tevuOPHk5kOcNDBjPEzaVWxvPE28LiyDOz23F6pX613+EB4WFKRLQGom8v6YS3ANeU m1MKZv1TDIZSfplde+EPsOiVMdBBfsy3iu1QBj2GO2krxJxKgzydC1sMdT7QOHDmzAzW IVamko7IxHTFBj00OaCmB1MG/wO7Df4y/wBj/SlO4hqtpbni2WTRfVfSPd1tgwaDNai5 UoCgRFhQok4YK/FsnQpQMz07KkMrlBU8OKqeim8HXZ5sgUjwf7nS5vVCeiSWhkn50F+v JkSXeIrB7C/fmIDLWxGprsvWpM5LZjf+k2bk74IwkVe5rvNjhTehHkty3cQu+Rkblg68 slkg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fp0c+kZE; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58438-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58438-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCVkAC0F0rI0MAJvScUX9ZudTLc+ZJUjEImFNlEH112TEL4u1iO8p/Ij4PInML0w0OXJiGx9zSdVDbEEiERrWTBfIUxLZw== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id bx24-20020a056a02051800b005dc16b88e8dsi490042pgb.353.2024.02.08.13.22.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 13:22:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58438-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fp0c+kZE; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58438-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58438-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 6A413B26294 for ; Thu, 8 Feb 2024 17:19:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A187812880D; Thu, 8 Feb 2024 17:17:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fp0c+kZE" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10A2684FAD; Thu, 8 Feb 2024 17:17:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707412656; cv=none; b=BYjJ5vZSIxIvFFc3cU9CVlNac9PsKRWmxlxtz7eRqLzkRRs9nCmRthCCjh1qt9dq7xDTVPmfaJ8EFIxj/IlPlBWNldhtoD3FllVCDW0OMbY/9Yy8YqEEefjkFdWyiJvyKl6U293g5LIxekqkcP3WxSiFSaNYjwdkfBOckAfmzgI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707412656; c=relaxed/simple; bh=HmO8BJAxHzacI5yK10Y9+ofU0L21g/VbhUyc1S5/3jg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gQzI0p83QScPd7J5kLD4xkhEu63XhVUXgVHo4sJUS0pvCB/CwljWyCKHSHoS2jSb+aF0e3La8s3ZfFgYPypV3Ixze56RQBhp0/ZuIVSV9kCwn4Q0oPMYjCLM84qZqqZtLZsRQL9bgpk8XEjDH0LoLTmh3HSuKHF36mR63XKr81Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=fp0c+kZE; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707412655; x=1738948655; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HmO8BJAxHzacI5yK10Y9+ofU0L21g/VbhUyc1S5/3jg=; b=fp0c+kZEowmfNUNS9/4Jd/LUh9xAaXlw14STOlzb+SRcCIOOvuGQKgVN Tl1IAVql6UUkNjrnpTpSqfpuGsXAyahmB4fv3ON7FPXAmY4FfDMqpA+o1 NrQ/doaAcVS6Rga7GO31fwqC9dSBdn5gDY2hIiqEWWc2QYIFozv7kyrbx qNT6vkLPRaGVkjpCknFgD6TVi0/AYfFUAnuqY69fdHakF6bscpjWhc6iQ 3g409BqEu3b4UoZ2a5GvaXprWIVtzzl3QDDhboWZDvAd5CsK7sda90P/y VCMmpDgGpohWDOLfq3KyzwTu7oKV3T5toJTg/aeXA8zLYpQcsWQmAvfPb w==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1565672" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1565672" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 09:17:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934195372" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934195372" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 09:17:30 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1BCD013C5; Thu, 8 Feb 2024 18:59:41 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Miguel Ojeda , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton , Geert Uytterhoeven Subject: [PATCH v1 02/15] auxdisplay: linedisp: Free allocated resources in ->release() Date: Thu, 8 Feb 2024 18:58:45 +0200 Message-ID: <20240208165937.2221193-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208165937.2221193-1-andriy.shevchenko@linux.intel.com> References: <20240208165937.2221193-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790367358581110760 X-GMAIL-MSGID: 1790367358581110760 While there is no issue currently with the resources allocation, the code may still be made more robust by deallocating message in the ->release() callback. Signed-off-by: Andy Shevchenko --- drivers/auxdisplay/line-display.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/auxdisplay/line-display.c b/drivers/auxdisplay/line-display.c index 03e7f104aa1a..310e9bfb41ae 100644 --- a/drivers/auxdisplay/line-display.c +++ b/drivers/auxdisplay/line-display.c @@ -188,8 +188,16 @@ static struct attribute *linedisp_attrs[] = { }; ATTRIBUTE_GROUPS(linedisp); +static void linedisp_release(struct device *dev) +{ + struct linedisp *linedisp = container_of(dev, struct linedisp, dev); + + kfree(linedisp->message); +} + static const struct device_type linedisp_type = { .groups = linedisp_groups, + .release = linedisp_release, }; /** @@ -253,7 +261,6 @@ void linedisp_unregister(struct linedisp *linedisp) { device_del(&linedisp->dev); del_timer_sync(&linedisp->timer); - kfree(linedisp->message); put_device(&linedisp->dev); } EXPORT_SYMBOL_GPL(linedisp_unregister);