Re: [PATCH 2/6] i2c-xiic: Fix a possible NULL pointer access

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

 



On Thu, Aug 09, 2012 at 07:07:43PM +0530, Shubhrajyoti D wrote:
> platform_get_resource uses pdev so move the function
> platform_set_drvdata(pdev, NULL) after the get_resource.

This descriptions sounds as you'd assume pdev is set to NULL here?
Careful, platform_set_drvdata() does not clear pdev, but driver_data of
pdev->dev!

So, I guess the rest of this series is bogus?

It would be worth checking if other drivers have the same pattern as the
omap driver where the fix was valid for other reasons. Are you
interested in doing that (perfectly fine to say no).

Regards,

   Wolfram

> 
> Signed-off-by: Shubhrajyoti D <shubhrajyoti@xxxxxx>
> ---
> untested
> 
>  drivers/i2c/busses/i2c-xiic.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
> index 641d0e5..a28479a 100644
> --- a/drivers/i2c/busses/i2c-xiic.c
> +++ b/drivers/i2c/busses/i2c-xiic.c
> @@ -784,8 +784,6 @@ static int __devexit xiic_i2c_remove(struct platform_device* pdev)
>  
>  	xiic_deinit(i2c);
>  
> -	platform_set_drvdata(pdev, NULL);
> -
>  	free_irq(platform_get_irq(pdev, 0), i2c);
>  
>  	iounmap(i2c->base);
> @@ -795,6 +793,7 @@ static int __devexit xiic_i2c_remove(struct platform_device* pdev)
>  		release_mem_region(res->start, resource_size(res));
>  
>  	kfree(i2c);
> +	platform_set_drvdata(pdev, NULL);
>  
>  	return 0;
>  }
> -- 
> 1.7.5.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux