Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753410AbdHKRMD (ORCPT ); Fri, 11 Aug 2017 13:12:03 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:45343 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752723AbdHKRMB (ORCPT ); Fri, 11 Aug 2017 13:12:01 -0400 Date: Fri, 11 Aug 2017 19:11:53 +0200 (CEST) From: Sebastian Ott X-X-Sender: sebott@schleppi To: Joerg Roedel cc: Gerald Schaefer , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Joerg Roedel Subject: Re: [PATCH v3] iommu/s390: Add support for iommu_device handling In-Reply-To: References: <1502274354-643-1-git-send-email-joro@8bytes.org> <20170811073118.GF30515@8bytes.org> User-Agent: Alpine 2.20 (LFD 67 2015-01-07) Organization: =?ISO-8859-15?Q?=22IBM_Deutschland_Research_&_Development_GmbH_=2F_Vorsitzende_des_Aufsichtsrats=3A_Martina_Koederitz_Gesch=E4ftsf=FChrung=3A_Dirk_Wittkopp_Sitz_der_Gesellschaft=3A_B=F6blingen_=2F_Registergericht?= =?ISO-8859-15?Q?=3A_Amtsgericht_Stuttgart=2C_HRB_243294=22?= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-TM-AS-GCONF: 00 x-cbid: 17081117-0040-0000-0000-000003EFDBFD X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17081117-0041-0000-0000-0000208F6DB6 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-08-11_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1708110266 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1207 Lines: 38 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