* [PATCH] isdn: Return -EINTR in gigaset_start() if locking attempts fails.
@ 2012-03-16 13:10 santosh nayak
2012-03-17 6:18 ` David Miller
2012-03-17 10:31 ` Tilman Schmidt
0 siblings, 2 replies; 6+ messages in thread
From: santosh nayak @ 2012-03-16 13:10 UTC (permalink / raw)
To: hjlipp
Cc: tilman, isdn, gigaset307x-common, netdev, linux-media,
kernel-janitors, Santosh Nayak
From: Santosh Nayak <santoshprasadnayak@gmail.com>
If locking attempt was interrupted by a signal then we should
return -EINTR so that caller can take appropriate action.
We have 3 callers: gigaset_probe(), gigaset_tty_open() and
gigaset_probe(). Each caller tries to free allocated memory
if lock fails. This is possible if we returns -EINTR.
Signed-off-by: Santosh Nayak <santoshprasadnayak@gmail.com>
---
drivers/isdn/gigaset/common.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c
index 7679270..2d10f3a 100644
--- a/drivers/isdn/gigaset/common.c
+++ b/drivers/isdn/gigaset/common.c
@@ -903,7 +903,7 @@ int gigaset_start(struct cardstate *cs)
unsigned long flags;
if (mutex_lock_interruptible(&cs->mutex))
- return 0;
+ return -EINTR;
spin_lock_irqsave(&cs->lock, flags);
cs->connected = 1;
--
1.7.4.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] isdn: Return -EINTR in gigaset_start() if locking attempts fails.
2012-03-16 13:10 [PATCH] isdn: Return -EINTR in gigaset_start() if locking attempts fails santosh nayak
@ 2012-03-17 6:18 ` David Miller
2012-03-17 15:56 ` santosh prasad nayak
2012-03-17 10:31 ` Tilman Schmidt
1 sibling, 1 reply; 6+ messages in thread
From: David Miller @ 2012-03-17 6:18 UTC (permalink / raw)
To: santoshprasadnayak
Cc: hjlipp, tilman, isdn, gigaset307x-common, netdev, linux-media,
kernel-janitors
From: santosh nayak <santoshprasadnayak@gmail.com>
Date: Fri, 16 Mar 2012 18:40:13 +0530
> We have 3 callers: gigaset_probe(), gigaset_tty_open() and
> gigaset_probe(). Each caller tries to free allocated memory
> if lock fails. This is possible if we returns -EINTR.
Look again at the callers.
They interpret "0" as an error, so your patch would break the driver.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] isdn: Return -EINTR in gigaset_start() if locking attempts fails.
2012-03-16 13:10 [PATCH] isdn: Return -EINTR in gigaset_start() if locking attempts fails santosh nayak
2012-03-17 6:18 ` David Miller
@ 2012-03-17 10:31 ` Tilman Schmidt
1 sibling, 0 replies; 6+ messages in thread
From: Tilman Schmidt @ 2012-03-17 10:31 UTC (permalink / raw)
To: santosh nayak
Cc: hjlipp, isdn, gigaset307x-common, netdev, linux-media,
kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 745 bytes --]
Am 16.03.2012 14:10, schrieb santosh nayak:
> From: Santosh Nayak <santoshprasadnayak@gmail.com>
>
> If locking attempt was interrupted by a signal then we should
> return -EINTR so that caller can take appropriate action.
NACK.
The return value of gigaset_start(), as documented in its
header comment, is:
* 1 - success, 0 - error
Its callers rely on this. If you want to change it, you must
also change the documentation and the callers accordingly.
In its current form the patch would just break the driver.
Thanks,
Tilman
--
Tilman Schmidt E-Mail: tilman@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] isdn: Return -EINTR in gigaset_start() if locking attempts fails.
2012-03-17 6:18 ` David Miller
@ 2012-03-17 15:56 ` santosh prasad nayak
2012-03-17 20:58 ` David Miller
0 siblings, 1 reply; 6+ messages in thread
From: santosh prasad nayak @ 2012-03-17 15:56 UTC (permalink / raw)
To: David Miller
Cc: hjlipp, tilman, isdn, gigaset307x-common, netdev, linux-media,
kernel-janitors
Yes. You are right.
Caller is interpreting 0 in opposite way of normal sequence.
Thats why I misunderstood it.
In general, 0 means success and on error we return -ve.
Here its opposite.
regards
Santosh
On Sat, Mar 17, 2012 at 11:48 AM, David Miller <davem@davemloft.net> wrote:
> From: santosh nayak <santoshprasadnayak@gmail.com>
> Date: Fri, 16 Mar 2012 18:40:13 +0530
>
>> We have 3 callers: gigaset_probe(), gigaset_tty_open() and
>> gigaset_probe(). Each caller tries to free allocated memory
>> if lock fails. This is possible if we returns -EINTR.
>
> Look again at the callers.
>
> They interpret "0" as an error, so your patch would break the driver.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] isdn: Return -EINTR in gigaset_start() if locking attempts fails.
2012-03-17 15:56 ` santosh prasad nayak
@ 2012-03-17 20:58 ` David Miller
2012-03-17 21:28 ` Julia Lawall
0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2012-03-17 20:58 UTC (permalink / raw)
To: santoshprasadnayak
Cc: hjlipp, tilman, isdn, gigaset307x-common, netdev, linux-media,
kernel-janitors
From: santosh prasad nayak <santoshprasadnayak@gmail.com>
Date: Sat, 17 Mar 2012 21:26:14 +0530
> Caller is interpreting 0 in opposite way of normal sequence.
> Thats why I misunderstood it.
The simple fact is that you didn't even look at the code at the call
sites when you wrote this patch, and that's the first thing anyone is
going to do when reviewing it.
Therefore your laziness results in more useless work for other people.
I just wanted to point out how selfish and anti-social this kind of
behavior is.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] isdn: Return -EINTR in gigaset_start() if locking attempts fails.
2012-03-17 20:58 ` David Miller
@ 2012-03-17 21:28 ` Julia Lawall
0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2012-03-17 21:28 UTC (permalink / raw)
To: David Miller
Cc: santoshprasadnayak, hjlipp, tilman, isdn, gigaset307x-common,
netdev, linux-media, kernel-janitors
On Sat, 17 Mar 2012, David Miller wrote:
> From: santosh prasad nayak <santoshprasadnayak@gmail.com>
> Date: Sat, 17 Mar 2012 21:26:14 +0530
>
>> Caller is interpreting 0 in opposite way of normal sequence.
>> Thats why I misunderstood it.
>
> The simple fact is that you didn't even look at the code at the call
> sites when you wrote this patch, and that's the first thing anyone is
> going to do when reviewing it.
>
> Therefore your laziness results in more useless work for other people.
> I just wanted to point out how selfish and anti-social this kind of
> behavior is.
Not to pour too much salt on a wound, but just 5 lines above the patch
site is the comment:
* Return value:
* 1 - success, 0 - error
And the error label also returns 0. So there is a lot of local
information that one can use to see what protocol the function follows.
That said, it's a bit too bad that two protocols have to coexist.
julia
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-03-17 21:28 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-16 13:10 [PATCH] isdn: Return -EINTR in gigaset_start() if locking attempts fails santosh nayak
2012-03-17 6:18 ` David Miller
2012-03-17 15:56 ` santosh prasad nayak
2012-03-17 20:58 ` David Miller
2012-03-17 21:28 ` Julia Lawall
2012-03-17 10:31 ` Tilman Schmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).