Is this ok in a init_module
Hi all,
I m writing a driver which i am restricting it to a particular ip address.
i m passing that ip address as a parameter to the module and checking it.
If there is a valid ip address,i m proceeding.
otherwise i wont allow the module to get load.
i just return error from the init module itself.
my doubt is whether this kind of error checking is allowed in init module or not.
MODULE_PARM(ip_address,"s");
static char *ip_address="0";
#define MODULE_ERROR -1
static int init_module(void)
{
if(ip_address[0]=='0'){
printk(KERN_ALERT "Please pass any valid IP address as parameter\n");
return MODULE_ERROR;
}
//other inititalized stufff
..........
}
while giving without IP address it give the error
init_module "operation not permitted"
So i wish to know whether this code is ok or not?
Thanks,
Saranjothy
|