Re: [PATCH 1/2] i2c: (algo-pca) Fix chip reset function for PCA9665

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

 



On Thu, Sep 13, 2012 at 12:14:23PM +0200, Wolfram Sang wrote:
> On Wed, Sep 12, 2012 at 08:39:50PM -0700, Guenter Roeck wrote:
> > From: Thomas Kavanagh <tkavanagh@xxxxxxxxxxx>
> > 
> > The parameter passed to pca9665_reset is adap->data, not adap. Unless
> > adap->data happens to point back to adap, this can result in a kernel panic.
> 
> Like every write and read to a register which uses the same assumption
> AFAICS?
> 
You lost me there. Other reset functions are aware of and use the passed parameter
(adap->data). pca9665_reset overwrites the original reset function with
	pca_data->reset_chip = pca9665_reset;
but not ->data (which it can't overwrite since it is used by the read_byte and
write_byte functions). 

	static void pca9665_reset(void *pd)
		struct i2c_algo_pca_data *adap = pd;
	static void i2c_pca_pf_resetchip(void *pd)
		struct i2c_pca_pf_data *i2c = pd;
	static int i2c_pca_pf_readbyte32(void *pd, int reg)
		struct i2c_pca_pf_data *i2c = pd;

Guenter
--
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


[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