Re: problem using hrtimer struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/8/06, Jack Sparrow <virtualspy3@xxxxxxxxx> wrote:
Hi,

 I am working on writing a module which uses the hrtimre struct to find the
resolution of the kernel. Here is the module:

<snip>

 static int __init calib_init(void)
 {

         struct hrtimer *timer;
         void *temp;
         ktime_t starts = ktime_set(1,0); /* one second, zero nsecs */
         timer->function = begin_func;
         timer->data = (void *)temp;
         hrtimer_start(timer, starts, HRTIMER_REL);
         printk(KERN_INFO "Hello, world \n");

<snip>

 How can I correct the warning of eq.s 1,2? the hrtimer struct belongs to
hrtimer.c

Uh...you're accessing an unallocated pointer. WRONG. You either need to

 struct hrtimer timer;
 ...
 timer.function = ... ;

or

  struct hrimter *timer;
  timer = kmalloc(...);

Either way, what you have now is clearly bad code.

Thanks,
Nish

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux