Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3202659pxa; Tue, 18 Aug 2020 09:05:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfUdxbBYpVCOXIx3Ch8ZreKB/jKmRxV1OsUn9TR4IZ+e9IKGqtljw0LIqtGfiI1S+LfUtH X-Received: by 2002:aa7:de15:: with SMTP id h21mr20859357edv.23.1597766749694; Tue, 18 Aug 2020 09:05:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597766749; cv=none; d=google.com; s=arc-20160816; b=IDlDTw6XUYZ4gdSitHw+2b88OFeJ3zkDpK7+e2V5nOkZV1FN7j9gJDS1ZnL7oBkW8Z DOVVTo6C6nXZE3YOBoXu001tENVhEi7m30Uk69fq1dvqO4W+Y88TKZcJxyXbq+U5Towm 7GrZr+mm/x/lpcuLGfvwC0g3nA49dWkXl/Tu1tTh00bvNt+hRs+6SOy1IcZHyUdQsij+ vYFdIl37Lks/eqlVP1WdLifrY9ZXS8Eq4dR/1RBcOzRoB570yxzbEr9mCaqODQ7F6eEM 7N8WWD2O58X1K4/fTwCibDNlxSu+0LGH0bDidtRb8u6Va52Z7AXmn6WS9RLWvyWYFzXP kg8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=JB8EfdnBuDNW3fHekM4Xs0GCzNgvaZJmFr6FyOpr2v0=; b=sBdwp2zgP0NOdAJxEdmCxbzFnTWDeUxkBpnhIW9GOyZJK2fV/v/unb+nP1KWYg7nBy b2Zd3wiKwzamSLf7pRuQGJq3IcvCJQrKkd/Nc+UAZ0K05yLOhn3UqYZ9JwquNgwYeqc4 d6QEiqZ8l4KstlGNG5fesBRNuVwuttpw1eTA+ec+MUSegQM9vFuO9/yZkwwMtJts9HPK 5EM1uUdlap19Ou67CbgFkaL3sI1ZtY8NEcNhLMYdXi9TcOcwSNfP5vMCB15G1pKVnwzJ 8F7GC6sgE92uJOy7XYDfzorERBYSrvQRuoq3e2oy+YuIhBh87UMAaVuHntSVByUDwCwP xV5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kt90pnhs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y3si12489132eju.146.2020.08.18.09.05.25; Tue, 18 Aug 2020 09:05:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kt90pnhs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726741AbgHRQEq (ORCPT + 99 others); Tue, 18 Aug 2020 12:04:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726640AbgHRQEc (ORCPT ); Tue, 18 Aug 2020 12:04:32 -0400 Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1364C061389 for ; Tue, 18 Aug 2020 09:04:31 -0700 (PDT) Received: by mail-qt1-x844.google.com with SMTP id k18so15486387qtm.10 for ; Tue, 18 Aug 2020 09:04:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=JB8EfdnBuDNW3fHekM4Xs0GCzNgvaZJmFr6FyOpr2v0=; b=kt90pnhsyVARanjQ9njLpjrSBJ5NQfpD0etrNKhdcS8EIcHIyORlTTXv62fx4/6P8F NG0N3+QsMlFjdXgO0Z7wjYzJmzot9eYRdjcdOqWMPJwpLo+UhB/xuESEIPbKAxIdPzNJ 9Mum08CkckVIRCx0SjmdPeIMUCmAmP/JJBj9XPVFsVgVUilemL5CSklA2qYsOKcLyxtV VRW1nNLF9ZPp7jVIMHb0/DinKg8pqGdyrkUsWKnltnuIzfpnTj2DBFf92nBgyj7/qtbb y2M5XVFdLvu6WDXgccYp5obPyE4kkyjeFLK/5V2Bqc0xEg3y8CkA9ZDUhxnzpIit2bZs GPew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JB8EfdnBuDNW3fHekM4Xs0GCzNgvaZJmFr6FyOpr2v0=; b=kPiUYnwlhk0WiMMUOW95cm8LhqDcvYBg4EKzNmlk/aHLflthVMmlUDpdD//WCCOBel BpOxSVIGQR4yF+ir0p0/F0x8a5CiIm8kMwMa5/pOklpB2c5TvesEQYw+Rdf/mCutccCv KJtz8uDWSdKyS2cAFgKgyJwjGegDvJZBZaSZQF/VxWgCAItpGukjecI24vLCsgaaxswS gQRb4Sln34/H8yCQDqUuWOKOLZ4Cn92+6spRDoURZqPPaE9g9B3pJ6Zyf1vC6BNaqYl2 fFk1K3S3VjodNIt5muMjP2jmf+2MHRZCGYp4MLyNLuyvc2Q/IRcVEX+hywPfJVQlnjQH RV9A== X-Gm-Message-State: AOAM5327QjP3jcvImLMwMduRhKQj5EDbOvOM2XaaG391KChnV7KVqlFY ZjzM4vn6UZZKPR3QTHLEIQo= X-Received: by 2002:aed:2986:: with SMTP id o6mr18435372qtd.105.1597766671154; Tue, 18 Aug 2020 09:04:31 -0700 (PDT) Received: from tong-desktop.local ([2601:5c0:c100:b9d:f9e2:64b4:fbc4:6485]) by smtp.googlemail.com with ESMTPSA id z17sm20732979qkj.62.2020.08.18.09.04.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2020 09:04:30 -0700 (PDT) From: Tong Zhang To: jikos@kernel.org, dsterba@suse.com, gregkh@linuxfoundation.org, jirislaby@kernel.org, ztong0001@gmail.com, linux-kernel@vger.kernel.org Subject: [PATCH v2] tty: ipwireless: fix error handling Date: Tue, 18 Aug 2020 12:03:58 -0400 Message-Id: <20200818160401.4736-1-ztong0001@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ipwireless_send_packet() can only return 0 on success and -ENOMEM on error, the caller should check non zero for error condition v2: - According to Jiri's comment, I made the checking consistent with the rest of the kernel. I also rebased the code using f684668a24ec. Thank you Jiri! Signed-off-by: Tong Zhang --- drivers/tty/ipwireless/network.c | 4 ++-- drivers/tty/ipwireless/tty.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/tty/ipwireless/network.c b/drivers/tty/ipwireless/network.c index cf20616340a1..fe569f6294a2 100644 --- a/drivers/tty/ipwireless/network.c +++ b/drivers/tty/ipwireless/network.c @@ -117,7 +117,7 @@ static int ipwireless_ppp_start_xmit(struct ppp_channel *ppp_channel, skb->len, notify_packet_sent, network); - if (ret == -1) { + if (ret < 0) { skb_pull(skb, 2); return 0; } @@ -134,7 +134,7 @@ static int ipwireless_ppp_start_xmit(struct ppp_channel *ppp_channel, notify_packet_sent, network); kfree(buf); - if (ret == -1) + if (ret < 0) return 0; } kfree_skb(skb); diff --git a/drivers/tty/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c index fad3401e604d..23584769fc29 100644 --- a/drivers/tty/ipwireless/tty.c +++ b/drivers/tty/ipwireless/tty.c @@ -218,7 +218,7 @@ static int ipw_write(struct tty_struct *linux_tty, ret = ipwireless_send_packet(tty->hardware, IPW_CHANNEL_RAS, buf, count, ipw_write_packet_sent_callback, tty); - if (ret == -1) { + if (ret < 0) { mutex_unlock(&tty->ipw_tty_mutex); return 0; } -- 2.25.1