[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191120140211.GA2935300@kroah.com>
Date:   Wed, 20 Nov 2019 15:02:11 +0100
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     patrick.rudolph@...ements.com
Cc:     linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
        Alexios Zavras <alexios.zavras@...el.com>,
        Allison Randal <allison@...utok.net>,
        Stephen Boyd <swboyd@...omium.org>,
        Julius Werner <jwerner@...omium.org>,
        Samuel Holland <samuel@...lland.org>
Subject: Re: [PATCH 1/2] firmware: google: Expose CBMEM over sysfs
On Wed, Nov 20, 2019 at 02:39:46PM +0100, patrick.rudolph@...ements.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);
Ick, you just raced userspace and lost :(
Please set the default group for the driver (dev_groups), so that the
driver core will correctly create and remove this group without you
having to do anything.
thanks,
greg k-h
Powered by blists - more mailing lists
 
