Message ID | 1331903413-11426-1-git-send-email-santoshprasadnayak@gmail.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers |
Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from <linux-media-owner@vger.kernel.org>) id 1S8Wwg-0007k6-59 for patchwork@linuxtv.org; Fri, 16 Mar 2012 14:11:50 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-3) with esmtp for <patchwork@linuxtv.org> id 1S8Wwf-00060X-Ei; Fri, 16 Mar 2012 14:11:50 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754634Ab2CPNLj (ORCPT <rfc822;patchwork@linuxtv.org>); Fri, 16 Mar 2012 09:11:39 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:33966 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750838Ab2CPNLi (ORCPT <rfc822;linux-media@vger.kernel.org>); Fri, 16 Mar 2012 09:11:38 -0400 Received: by pbcun15 with SMTP id un15so200200pbc.19 for <multiple recipients>; Fri, 16 Mar 2012 06:11:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=jkXjLE3jXq/2tiqppUcist7KNfFaJclTDixvHS3WZiQ=; b=rFbHT9FVfG7NGfJYe1WcQR07dvZXbouCnoroPTc/M1CnRXn6jO4NE+KnOOD9h1t7cr mbMH+w8R/9iwxB4th4rw4AN+9ESZ6b7JWECdlDvCYCiuhBpfkCi8v1ucB2QvNHCNCp+k WqyQ+6dpMG68MnS05lmGUqN2eKhPMdC7XYnGFwpXsaDPNCjr0l3q6vUTv3OY/GqErvrT BKNrNl7mqs8g/FJ7TBbRaV2zqVM5aRDQS2jND+Dq52VzV/2LuEbv1knAq11yBJC29gjB oeD4J2S1k8butpQy9KS+QMZjBmGq0p4Bh85OqJbqNK9Hbyqq/B2ifSf7itq70hQ4aApV foqA== Received: by 10.68.226.170 with SMTP id rt10mr14663359pbc.117.1331903497502; Fri, 16 Mar 2012 06:11:37 -0700 (PDT) Received: from localhost.localdomain ([64.103.156.72]) by mx.google.com with ESMTPS id ko12sm4275103pbb.52.2012.03.16.06.11.33 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 16 Mar 2012 06:11:36 -0700 (PDT) From: santosh nayak <santoshprasadnayak@gmail.com> To: hjlipp@web.de Cc: tilman@imap.cc, isdn@linux-pingi.de, gigaset307x-common@lists.sourceforge.net, netdev@vger.kernel.org, linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org, Santosh Nayak <santoshprasadnayak@gmail.com> Subject: [PATCH] isdn: Return -EINTR in gigaset_start() if locking attempts fails. Date: Fri, 16 Mar 2012 18:40:13 +0530 Message-Id: <1331903413-11426-1-git-send-email-santoshprasadnayak@gmail.com> X-Mailer: git-send-email 1.7.4.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.3.16.130323 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' FORGED_FROM_GMAIL 0.1, MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1100_1199 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __FROM_GMAIL 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __PHISH_SPEAR_STRUCTURE_1 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' |
Commit Message
santosh nayak
March 16, 2012, 1:10 p.m. UTC
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(-)
Comments
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. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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
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. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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;