mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-08 14:13:53 +00:00
cxl: Fix unregister_region() callback parameter assignment
In devm_cxl_add_region(), devm_add_action_or_reset() is called by passing in unregister_region() with data ptr of 'cxlr'. However, in unregister_region(), the passed in parameter is incorrectly assumed to be a 'struct device' rather than the 'cxlr' pointer. The code has been working because 'struct device' is the first member of 'struct cxl_region'. Issue found by inspection. Fix the assignment so that cxlr is pointing directly to the passed in parameter. Not flagged for -stable since there is no functional impact of this fix. Signed-off-by: Dave Jiang <dave.jiang@intel.com> Reviewed-by: Ira Weiny <ira.weiny@intel.com> Link: https://lore.kernel.org/r/170258123810.952211.3907381447996426480.stgit@djiang5-mobl3 Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
cb46fca88d
commit
ace196de69
@ -2083,13 +2083,13 @@ static struct cxl_region *to_cxl_region(struct device *dev)
|
||||
return container_of(dev, struct cxl_region, dev);
|
||||
}
|
||||
|
||||
static void unregister_region(void *dev)
|
||||
static void unregister_region(void *_cxlr)
|
||||
{
|
||||
struct cxl_region *cxlr = to_cxl_region(dev);
|
||||
struct cxl_region *cxlr = _cxlr;
|
||||
struct cxl_region_params *p = &cxlr->params;
|
||||
int i;
|
||||
|
||||
device_del(dev);
|
||||
device_del(&cxlr->dev);
|
||||
|
||||
/*
|
||||
* Now that region sysfs is shutdown, the parameter block is now
|
||||
@ -2100,7 +2100,7 @@ static void unregister_region(void *dev)
|
||||
detach_target(cxlr, i);
|
||||
|
||||
cxl_region_iomem_release(cxlr);
|
||||
put_device(dev);
|
||||
put_device(&cxlr->dev);
|
||||
}
|
||||
|
||||
static struct lock_class_key cxl_region_key;
|
||||
|
Loading…
Reference in New Issue
Block a user