From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastian Ott Subject: Re: [PATCH v3] iommu/s390: Add support for iommu_device handling Date: Fri, 11 Aug 2017 19:11:53 +0200 (CEST) Message-ID: References: <1502274354-643-1-git-send-email-joro@8bytes.org> <20170811073118.GF30515@8bytes.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Joerg Roedel Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, Joerg Roedel , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Gerald Schaefer List-Id: iommu@lists.linux-foundation.org On Fri, 11 Aug 2017, Sebastian Ott wrote: > * iommu_release_device must not release the struct device but the > structure it is embedded in: struct iommu_device (I'll send a patch > for that) --->8 >>From 2839c92e038af47b8cb569f84d571878c54d1815 Mon Sep 17 00:00:00 2001 From: Sebastian Ott Date: Fri, 11 Aug 2017 19:04:00 +0200 Subject: [PATCH] iommu: fix the release function of iommu_class The release function of iommu_class must not only free the device structure it gets called with but the whole structure the device is embedded in - struct iommu_device. Signed-off-by: Sebastian Ott --- drivers/iommu/iommu-sysfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/iommu-sysfs.c b/drivers/iommu/iommu-sysfs.c index c58351e..b65a501 100644 --- a/drivers/iommu/iommu-sysfs.c +++ b/drivers/iommu/iommu-sysfs.c @@ -34,7 +34,9 @@ static const struct attribute_group *iommu_dev_groups[] = { static void iommu_release_device(struct device *dev) { - kfree(dev); + struct iommu_device *iommu = container_of(dev, struct iommu_device, dev); + + kfree(iommu); } static struct class iommu_class = { -- 2.5.5