LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 08-16-2006, 10:30 AM   #1
saranjothy
LQ Newbie
 
Registered: Feb 2006
Posts: 15

Rep: Reputation: 0
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
 
Old 08-17-2006, 05:55 AM   #2
debulu
Member
 
Registered: May 2006
Location: India
Distribution: Redhat
Posts: 49

Rep: Reputation: 15
Hi Saranjothy,
I feel that Your code is fine. But returning non-zero value(You are returning -1) I think is not permitted. Plz check this out and let me know what happens.

Enjoy
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
init_module: no such device salaw Linux - Wireless Networking 0 01-05-2005 06:12 PM
intel8x0.o: init_module: No such device SpeedDingo Linux - Hardware 5 05-17-2004 10:29 PM
Modprobe causes error: init_module: No such device falconfighter Mandriva 5 12-18-2003 06:27 PM
sound blaster audigy emu10k init_module: No such device toovato Linux - Hardware 9 08-27-2003 09:13 PM
init_module error blueplazma Linux - Software 0 06-24-2002 11:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 04:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration