Re: [PATCH 1/1] twl4030-madc: Fix arbitrarily initialized function pointer

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

 




On Wed,  2 Jul 2008 16:36:36 +0300, Viktor Rosendahl
<viktor.rosendahl@xxxxxxxxx> wrote:
> req is an automatic variable and thus we cannot rely on it being
> initialized to
> zero (I am leaving the 0!= NULL discussion aside). Other functions test
> if this pointer is NULL, in order to determine whether it is a valid
> address or
> not.


> +		req.func_cb	= NULL;

maybe below is a better patch:

diff --git a/drivers/i2c/chips/twl4030-madc.c
b/drivers/i2c/chips/twl4030-madc.c
index 72b126b..6d8915e 100644
--- a/drivers/i2c/chips/twl4030-madc.c
+++ b/drivers/i2c/chips/twl4030-madc.c
@@ -360,7 +360,7 @@ static int twl4030_madc_ioctl(struct inode *inode,
struct file *filp,
 
        switch (cmd) {
        case TWL4030_MADC_IOCX_ADC_RAW_READ: {
-               struct twl4030_madc_request req;
+               static struct twl4030_madc_request req;
                if (par.channel >= TWL4030_MADC_MAX_CHANNELS)
                        return -EINVAL;
-- 
Best Regards,

Felipe Balbi
http://blog.felipebalbi.com
me@xxxxxxxxxxxxxxx

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux