- An errno is missed in rev. 1.11 while converting return statement to

goto statement.
- A local variable still in use is intercepted in rev. 1.6.  Define and
  use variable of its own.
This commit is contained in:
enami 2009-02-02 11:19:29 +00:00
parent 1cdee1d2a2
commit ad526ef003
1 changed files with 7 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_devsw.c,v 1.24 2009/01/20 18:20:48 drochner Exp $ */
/* $NetBSD: subr_devsw.c,v 1.25 2009/02/02 11:19:29 enami Exp $ */
/*-
* Copyright (c) 2001, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@ -69,7 +69,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.24 2009/01/20 18:20:48 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.25 2009/02/02 11:19:29 enami Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@ -120,6 +120,7 @@ devsw_attach(const char *devname,
struct devsw_conv *conv;
char *name;
int error, i;
size_t len;
if (devname == NULL || cdev == NULL)
return (EINVAL);
@ -195,13 +196,14 @@ devsw_attach(const char *devname,
max_devsw_convs = new;
}
i = strlen(devname) + 1;
name = kmem_alloc(i, KM_NOSLEEP);
len = strlen(devname) + 1;
name = kmem_alloc(len, KM_NOSLEEP);
if (name == NULL) {
devsw_detach_locked(bdev, cdev);
error = ENOMEM;
goto fail;
}
strlcpy(name, devname, i);
strlcpy(name, devname, len);
devsw_conv[i].d_name = name;
devsw_conv[i].d_bmajor = *bmajor;