Commit 3d93561d authored by Stephen Hemminger's avatar Stephen Hemminger

[netdrvr skge] handle proc_fs errors.

Existing code does not
	- check if proc_fs functions return error.
	- use proc_mkdir to make the directory.

Note pSkRootDir defined twice.
parent c02cf91a
......@@ -607,12 +607,6 @@ static uintptr_t TxQueueAddr[SK_MAX_MACS][2] = {{0x680, 0x600},{0x780, 0x700}};
static uintptr_t RxQueueAddr[SK_MAX_MACS] = {0x400, 0x480};
#ifdef CONFIG_PROC_FS
static struct proc_dir_entry *pSkRootDir;
#endif
/*****************************************************************************
*
* skge_probe - find all SK-98xx adapters
......@@ -638,7 +632,6 @@ static int __init skge_probe (void)
SK_BOOL BootStringCount = SK_FALSE;
int retval;
#ifdef CONFIG_PROC_FS
int proc_root_initialized = 0;
struct proc_dir_entry *pProcFile;
#endif
......@@ -758,26 +751,28 @@ static int __init skge_probe (void)
sizeof(SK_Root_Dir_entry) - 1);
/*Create proc (directory)*/
if(!proc_root_initialized) {
pSkRootDir = create_proc_entry(SK_Root_Dir_entry,
S_IFDIR | S_IWUSR | S_IRUGO | S_IXUGO, proc_net);
if(!pSkRootDir) {
pSkRootDir = proc_mkdir(SK_Root_Dir_entry, proc_net);
if (!pSkRootDir)
printk(KERN_WARNING "%s: Unable to create /proc/net/%s",
dev->name, SK_Root_Dir_entry);
else
pSkRootDir->owner = THIS_MODULE;
proc_root_initialized = 1;
}
}
/* Create proc file */
pProcFile = create_proc_entry(dev->name,
if (pSkRootDir &&
(pProcFile = create_proc_entry(dev->name,
S_IFREG | S_IXUSR | S_IWGRP | S_IROTH,
pSkRootDir);
pSkRootDir))) {
pProcFile->read_proc = sk_proc_read;
pProcFile->write_proc = NULL;
pProcFile->nlink = 1;
pProcFile->size = sizeof(dev->name + 1);
pProcFile->data = (void *)pProcFile;
pProcFile->owner = THIS_MODULE;
}
#endif
pNet->PortNr = 0;
......@@ -831,10 +826,10 @@ static int __init skge_probe (void)
#endif
#ifdef CONFIG_PROC_FS
pProcFile = create_proc_entry(dev->name,
if (pSkRootDir
&& (pProcFile = create_proc_entry(dev->name,
S_IFREG | S_IXUSR | S_IWGRP | S_IROTH,
pSkRootDir);
pSkRootDir))) {
pProcFile->read_proc = sk_proc_read;
pProcFile->write_proc = NULL;
......@@ -842,6 +837,7 @@ static int __init skge_probe (void)
pProcFile->size = sizeof(dev->name + 1);
pProcFile->data = (void *)pProcFile;
pProcFile->owner = THIS_MODULE;
}
#endif
memcpy((caddr_t) &dev->dev_addr,
......@@ -1188,6 +1184,7 @@ SK_EVPARA EvPara;
#ifdef CONFIG_PROC_FS
/* clear proc-dir */
if (pSkRootDir)
remove_proc_entry(pSkRootDir->name, proc_net);
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment