Re: [PATCH] sound: Don't assume i2c device probing always succeeds

2009-10-04 Thread Jean Delvare
Hi Takashi, On Thu, 01 Oct 2009 08:52:59 +0200, Takashi Iwai wrote: At Wed, 30 Sep 2009 18:55:05 +0200, Jean Delvare wrote: On Wed, 30 Sep 2009 17:15:49 +0200, Takashi Iwai wrote: Yes, indeed I prefer NULL check because the user can know the error at the right place. I share your

Re: [PATCH] sound: Don't assume i2c device probing always succeeds

2009-10-04 Thread Takashi Iwai
At Sun, 4 Oct 2009 11:35:21 +0200, Jean Delvare wrote: Hi Takashi, On Thu, 01 Oct 2009 08:52:59 +0200, Takashi Iwai wrote: At Wed, 30 Sep 2009 18:55:05 +0200, Jean Delvare wrote: On Wed, 30 Sep 2009 17:15:49 +0200, Takashi Iwai wrote: Yes, indeed I prefer NULL check because

Re: [PATCH] sound: Don't assume i2c device probing always succeeds

2009-10-01 Thread Takashi Iwai
At Wed, 30 Sep 2009 18:55:05 +0200, Jean Delvare wrote: On Wed, 30 Sep 2009 17:15:49 +0200, Takashi Iwai wrote: Yes, indeed I prefer NULL check because the user can know the error at the right place. I share your concern about the code addition, though :) I already made a patch

[PATCH] sound: Don't assume i2c device probing always succeeds

2009-09-30 Thread Jean Delvare
If i2c device probing fails, then there is no driver to dereference after calling i2c_new_device(). Stop assuming that probing will always succeed, to avoid NULL pointer dereferences. We have an easier access to the driver anyway. Reported-by: Tim Shepard s...@alum.mit.edu Signed-off-by: Jean

Re: [PATCH] sound: Don't assume i2c device probing always succeeds

2009-09-30 Thread Takashi Iwai
At Wed, 30 Sep 2009 15:25:42 +0200, Jean Delvare wrote: If i2c device probing fails, then there is no driver to dereference after calling i2c_new_device(). Stop assuming that probing will always succeed, to avoid NULL pointer dereferences. We have an easier access to the driver anyway.

Re: [PATCH] sound: Don't assume i2c device probing always succeeds

2009-09-30 Thread Jean Delvare
Hi Takashi, Thanks for the swift reply. On Wed, 30 Sep 2009 16:13:49 +0200, Takashi Iwai wrote: At Wed, 30 Sep 2009 15:25:42 +0200, Jean Delvare wrote: If i2c device probing fails, then there is no driver to dereference after calling i2c_new_device(). Stop assuming that probing will

Re: [PATCH] sound: Don't assume i2c device probing always succeeds

2009-09-30 Thread Takashi Iwai
At Wed, 30 Sep 2009 17:00:06 +0200, Jean Delvare wrote: Hi Takashi, Thanks for the swift reply. On Wed, 30 Sep 2009 16:13:49 +0200, Takashi Iwai wrote: At Wed, 30 Sep 2009 15:25:42 +0200, Jean Delvare wrote: If i2c device probing fails, then there is no driver to dereference

Re: [PATCH] sound: Don't assume i2c device probing always succeeds

2009-09-30 Thread Jean Delvare
On Wed, 30 Sep 2009 17:05:11 +0200, Johannes Berg wrote: On Wed, 2009-09-30 at 17:00 +0200, Jean Delvare wrote: The NULL check of client-driver, if followed by a call to i2c_unregister_device(), would indeed be enough. But unlike the onyx driver which we know we sometimes load

Re: [PATCH] sound: Don't assume i2c device probing always succeeds

2009-09-30 Thread Jean Delvare
On Wed, 30 Sep 2009 17:15:49 +0200, Takashi Iwai wrote: Yes, indeed I prefer NULL check because the user can know the error at the right place. I share your concern about the code addition, though :) I already made a patch below, but it's totally untested. It'd be helpful if someone can do