Subject: Re: [take17 1/4] kevent: Core files.

From: Evgeniy Polyakov <[email-masked]>
Date: Fri, 8 Sep 2006 10:38:09 +0400

On Thu, Sep 07, 2006 at 09:05:16PM -0700, [email-masked] ([email-masked]) wrote:
> > +static int __devinit kevent_user_init(void)
> > +{
> > +	int err = 0;
> > +
> > +	kevent_cache = kmem_cache_create("kevent_cache",
> > +			sizeof(struct kevent), 0, SLAB_PANIC, NULL, NULL);
> > +
> > +	err = misc_register(&kevent_miscdev);
> > +	if (err) {
> > +		printk(KERN_ERR "Failed to register kevent miscdev: err=%d.\n", err);
> > +		goto err_out_exit;
> > +	}
> > +
> > +	printk("KEVENT subsystem has been successfully registered.\n");
> > +
> > +	return 0;
> > +
> > +err_out_exit:
> > +	kmem_cache_destroy(kevent_cache);
> > +	return err;
> > +}
> 
> It's probably best to treat kmem_cache_create like a black box and check for 
> it returning null.

It can not return NULL, it will panic instead since I use SLAB_PANIC
flag.

> Thanks,
> Shaw

-- 
	Evgeniy Polyakov