[PATCH] [media] staging: Return -EINTR in s2250_probe() if fails to get lock.
santosh prasad nayak
santoshprasadnayak at gmail.com
Fri Mar 16 16:56:20 UTC 2012
On Fri, Mar 16, 2012 at 10:02 PM, Oliver Neukum <oliver at neukum.org> wrote:
> Am Freitag, 16. März 2012, 17:23:58 schrieb santosh nayak:
>> From: Santosh Nayak <santoshprasadnayak at gmail.com>
>>
>> In s2250_probe(), If locking attempt is interrupted by a signal then
>> it should return -EINTR after unregistering audio device and making free
>> the allocated memory.
>>
>> At present, if locking is interrupted by signal it will display message
>> "initialized successfully" and return success. This is wrong.
>
> Indeed there's a lot wrong here. The idea of having an interruptible
> sleep in probe() is arcane. You need a very, very, very good reason for that.
Can you please explain why interruptible sleep should not be in probe() ?
I am curious to know.
> The sane fix is using an uninterruptable sleep here.
>
> Second, while you are at it, fix the error case for no initialization
> due to a failing kmalloc(). You need to return -ENOMEM.
Are you talking about kmalloc or kzalloc ?
Because for failing kmalloc -ENOMEM is returned as shown below:
state = kmalloc(sizeof(struct s2250), GFP_KERNEL);
if (state == NULL) {
i2c_unregister_device(audio);
return -ENOMEM; // ENOMEM is returned here.
}
Regards
Santosh
>
> Regards
> Oliver
More information about the devel
mailing list