Reputation: 2706
I've got such a function:
void cleanup_module(void)
{
/*
* Unregister the device
*/
if(unregister_chrdev(Major, DEVICE_NAME)<0)
printk(KERN_ALERT "Error in unregister_chrdev:\n");
}
and error:
/home/student/kernel/hello.c: In function ‘cleanup_module’:
/home/student/kernel/hello.c:39:2: error: void value not ignored as it ought to be
This line is the one with if statement. Do you know what I'm doing wrong?
Upvotes: 3
Views: 2360
Reputation: 47493
This means that unregister_chrdev
doesn't have a return value (it's void
), but you have put it in an if. That is, you are using a void value which should have been ignored. Hence the error message.
Check out this question which asks why the return value was changed to void.
Upvotes: 4
Reputation: 1145
The error indicates that the unregister_chrdev()
function is a void
type function, i.e. it returns nothing. However, you are checking its return value with the <
operator.
Upvotes: 1