From patchwork Thu Feb 8 18:48:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198583 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp458904dyd; Thu, 8 Feb 2024 13:20:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IHuXjTInxNjYchPpjj4RrMiZWTgd7mnsWzXEksTHsU86PzMk+nFoXKoIfM9bjtCJwYuK+eh X-Received: by 2002:ad4:5bef:0:b0:68c:5d40:d0fd with SMTP id k15-20020ad45bef000000b0068c5d40d0fdmr722834qvc.17.1707427209919; Thu, 08 Feb 2024 13:20:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707427209; cv=pass; d=google.com; s=arc-20160816; b=Acx9dGevSvzL+XW7J80Erby7Cld7LEmQGMcudH/OuhUMc+igxQmjWLvVbZ1+g3Gg1i JcIXna0FL7R/9f/3ToZvv/jHYZUERp2oAhvq1wP2TS4+15S3zj4oqS51aHXdfnzGEB+b xT+QvLWLgFW+brby/eenFgLYIcvH1MY7eNIsLdnwXVQIcxEO/33o6oXWHyx2Dmlra+bv WLilB/JNP8fiuAC1/YQovvbsZLC5XzxT7Tgwg4yjDv/QoH0us3Jb7X2qln9V8cw3rCn/ fGIozV6FaOrsZBpW0pCFbA59ydJ5OQO5c6EbzWpQZOfLeLTub4V9EfrET+jDIO4QSjl4 azQg== 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=Fg1YJVcncIEqDpmai341Lnxk3+r3CM/JY0guoQ1+aWo=; b=KURs4LViYo2dyyVRF2LVwIgkhzX+4GnltTp8O4iHZxnDK6Zbyc6MnxlukrrTdYumFw IPU906DT8Oc5Ebm5X42AZz7BkZTFToOKYgAZWYL5jFv8IB9TrPcuVC+21c8DxN3elUMx 5gisQmy/6HUDkqlAhyinHMkbImbm3fk9XnV+h9sYFLVsztDee/TH0z9QXtLRbdgSlNs2 wDnRSb4uxOZzOc8zmAJlEU0LA6oTwJ9ww7gFW855tPYpW5ZPWzC6S9ZwPl/GHlepGiL1 i9+kc8U/5ouHZii+nIgen7bfDwG0DKSl1+Bjb4BSdil8FNuUvkMMCgf4VKBsxvJeQvj7 67vw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Ull0gAfJ; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58562-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58562-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCWDtviI9uL4fWrnE6wwinhy99hCqc3ygxNKLvPahcXsaXW1awiNLXS8Dg1Mc6gVVzWT/IzR0u6qBS16jMgJq+QqbV5ooA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u14-20020a0562141c0e00b0068cbfbee34esi418737qvc.294.2024.02.08.13.20.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 13:20:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58562-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Ull0gAfJ; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58562-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58562-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 245A41C298D6 for ; Thu, 8 Feb 2024 18:53:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 77B003C460; Thu, 8 Feb 2024 18:49:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Ull0gAfJ" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 54E2728699; Thu, 8 Feb 2024 18:49:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418171; cv=none; b=Zr5v2YUk3Co+3L/O8vg5bbEpg5ThLOVQpKZEdST3USMK/4OTKq3iLjGU+y55gqcf53tuLw0oUdoq7baXiZJMiwqvURXr5olSvNK8pRc0EBHq0Ty4Zzw/6rCNmtOcsVJsCBhwHMcW9yMtDFMYCxkMubZ8gcmSLWq/C+LKT8CDd00= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418171; c=relaxed/simple; bh=HmO8BJAxHzacI5yK10Y9+ofU0L21g/VbhUyc1S5/3jg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AU7KGpekw2luZvZiVoLSHvcyY4/aqdECwvfytXrbU8R7trXSVCPU67ZB2DfNn0/RS8y4QT86n89PytLlQIDTL2VXutD+b5uwoHkuukiuvgnmNpOCG3PMevmqJB1hnhqwsC9WZ1kCf/31kiJDH43zJynhffxyIRg5IOXj9S1I63Q= 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=Ull0gAfJ; arc=none smtp.client-ip=192.198.163.19 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=1707418169; x=1738954169; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HmO8BJAxHzacI5yK10Y9+ofU0L21g/VbhUyc1S5/3jg=; b=Ull0gAfJM6EgYPO9Fzm1s1DlV/Yedc+qV8TUHOf3/0kHNSuFmqbkRCf1 9O3raJpxjc1cOZy1Ew66oYALq+f9taZwGKcj3lKUV6yOeawz7Qoh52FVU 2vrf0ZrT+hu1Cs8RSL+3TKGaJGPkpShX1A9KdqEZGrFzRBsKLbZVGZIw0 yq/PwwLadF8+pg7r80EFv6J4cUCriX+jKmYBGBEvWOgNlKtM5rVW4WYxl 2n92zBsj8GJ8ziBhvvjDgjRUwaIZ+4q+58iW4FMVMAtFCw2ij8EDRWqTO i0C84p6IanuwjNiYFyjSxg84i1YLOBe0rIha4t0buvSOffW7zCJSdh8B/ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1186100" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1186100" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 10:49:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934215516" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934215516" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 10:49:22 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 44C0113C; Thu, 8 Feb 2024 20:49:21 +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 20:48:00 +0200 Message-ID: <20240208184919.2224986-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> References: <20240208184919.2224986-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: 1790367194047282963 X-GMAIL-MSGID: 1790367194047282963 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);