[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <e7ea8286-afb4-bf93-d2fa-190f4b4e3ea5@linux.ibm.com>
Date: Thu, 14 Mar 2019 17:27:06 +0100
From: Frederic Barrat <fbarrat@...ux.ibm.com>
To: "Alastair D'Silva" <alastair@....ibm.com>
Cc: "Alastair D'Silva" <alastair@...ilva.org>,
Andrew Donnellan <andrew.donnellan@....ibm.com>,
Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH 5/7] ocxl: Create a clear delineation between ocxl backend
& frontend
> diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c
> index 865b3d176431..424bb0b40afb 100644
> --- a/drivers/misc/ocxl/file.c
> +++ b/drivers/misc/ocxl/file.c
> -int ocxl_register_afu(struct ocxl_afu *afu)
> +int ocxl_file_register_afu(struct ocxl_afu *afu)
> {
> int minor;
> + int rc;
> + struct ocxl_file_info *info;
> + struct ocxl_fn *fn = afu->fn;
> + struct pci_dev *pci_dev = to_pci_dev(fn->dev.parent);
> +
> + info = kzalloc(sizeof(*info), GFP_KERNEL);
> + if (info == NULL)
> + return -ENOMEM;
>
> - minor = allocate_afu_minor(afu);
> - if (minor < 0)
> + info->afu = afu;
> +
> + minor = allocate_minor(info);
> + if (minor < 0) {
> + kfree(info);
> return minor;
> - afu->dev.devt = MKDEV(MAJOR(ocxl_dev), minor);
> - afu->dev.class = ocxl_class;
> - return device_register(&afu->dev);
> + }
> +
> + info->dev.parent = &fn->dev;
> + info->dev.devt = MKDEV(MAJOR(ocxl_dev), minor);
> + info->dev.class = ocxl_class;
> +
> + ocxl_afu_set_private(afu, info, ocxl_file_release);
We no longer define a 'release' method for the AFU device. We need one,
which should in turn free the info struct when the device ref count hits
0. That should explain the following error seen when unloading the driver:
"Device 'xyz' does not have a release() function, it is broken and must
be fixed. See Documentation/kobject.txt"
Fred
Powered by blists - more mailing lists