Messages in this thread | | | Date | Thu, 19 Dec 2019 18:17:05 +0100 | From | Greg Kroah-Hartman <> | Subject | Re: [PATCH v3 1/2] firmware: google: Expose CBMEM over sysfs |
| |
On Thu, Nov 28, 2019 at 01:50:50PM +0100, patrick.rudolph@9elements.com wrote: > +static int cbmem_probe(struct coreboot_device *cdev) > +{ > + struct device *dev = &cdev->dev; > + struct cb_priv *priv; > + int err; > + > + priv = kzalloc(sizeof(*priv), GFP_KERNEL); > + if (!priv) > + return -ENOMEM; > + > + memcpy(&priv->entry, &cdev->cbmem_entry, sizeof(priv->entry)); > + > + priv->remap = memremap(priv->entry.address, > + priv->entry.entry_size, MEMREMAP_WB); > + if (!priv->remap) { > + err = -ENOMEM; > + goto failure; > + } > + > + err = sysfs_create_group(&dev->kobj, &cb_mem_attr_group);
You just raced with userspace and lost :(
Set the driver's default attribute group up to point at cb_mem_attr_group and the driver core will handle creating and removing the group automatically for you correctly.
thanks,
greg k-h
| |