Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2927915pxa; Tue, 18 Aug 2020 01:36:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0JrLXSrbR8JdiFSAy5YqqpjhtwgQXc+tiALWNyqTeo6KvRQbmUTaLE3jnnXWaQ43XhxzE X-Received: by 2002:a17:906:7c4f:: with SMTP id g15mr18558115ejp.82.1597739802773; Tue, 18 Aug 2020 01:36:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597739802; cv=none; d=google.com; s=arc-20160816; b=sMOBXOZBbvZGEzNXz5lrutzlFibm+UNjTf/SOQF4clfecyhheMItXuf7EsJv+VoeZ6 AhS3eBEQOJ/gMKsQX8Dietka4ioxwjyCmuygc0hU77r1P4YZ91Jl/f4cXTkTIUbdjiBZ gbb/OYWEJNI9wTsg1xxh+w/ZAkgW/AMN0yt5SHF1kT78Ua7E7LY57OXBk80rDzS2zAxB Ln63inH1SbBUNwAe3k2L5XYrBWNmPH7q2+FUPBlk7rn5JUisb22hngkgA3vP80m9smJt kUK5gU4G8x+lBLKUlOJ+OpSKiNbtFF4k+T4xzq96G7/p5bU7mYv4V4PIuF8i2fvhq3cA mByA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject; bh=Re0tYm6kbctMDwqCO+5SGUDDrg/VlsT4jvWgv+xl6XE=; b=dx2YdC7NW9o3hAe3yQR9DRyTnPsQYwi9ACu7Oq06TRMjwlguQyARhLZIMLGb9LS29S kC/eQOqhZXZRIl/RfcnuG2vl4ka2SbGSCYZ/rzKiJgoTn2jLguJ09HGxB7DTztsev6Zc 7vlAqcR6faVqWhfoXyYNflUH8Vtaenw8Dfn+bQ5xUC4so0yQlh7jCP83pCx8TI4SEgEe /7kPXoNLT6uJbMFKAEskr47ic3y2Eu4xPBaLMQiKLHXASQNhwDB1fhZceFE7nOxVyfaJ yWuZA2rKXDE66BKb/iZHvXyq+lJLHuhc6hhsDsoCeiQ3Wlsoir4Sh3H8WN8R4/Cullil nbhg== ARC-Authentication-Results: i=1; mx.google.com; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t4si12738553ejt.506.2020.08.18.01.36.19; Tue, 18 Aug 2020 01:36:42 -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; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726633AbgHRIf0 (ORCPT + 99 others); Tue, 18 Aug 2020 04:35:26 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:36371 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726043AbgHRIfZ (ORCPT ); Tue, 18 Aug 2020 04:35:25 -0400 Received: by mail-ed1-f68.google.com with SMTP id ba10so14585734edb.3 for ; Tue, 18 Aug 2020 01:35:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Re0tYm6kbctMDwqCO+5SGUDDrg/VlsT4jvWgv+xl6XE=; b=LDM06F6gO7w+0EIMdsKR6yPlE4a5SbwrgPLY40DEqTVh4eYXHouZnBpttL+WNNiCGU crd+WD8lM6zhLRdKL9Sp4oJcCiifz+zT2cb/9n2Rycx3EKCIwi7OBCynET8OXinqnP0/ YEs/EeIbz7DQ3/70rFebrYsm0cFdyfbnibD4UC6jn7/0/HoZWe/hBh1xrn5duZt/e+ZP F127FLaOCeHNuZ3dWFyi66O5O8qQCOXJ1IpCxFAla0GyA0xCGMtz9MqwUeT13TlhUvIx AYQf6wS4KM6VDOS7ByCn/ufufXl6SZdTHnTbrZC7A559BMge1sk+mLJsqdBy1bmYFI7l D4jg== X-Gm-Message-State: AOAM531OqlOVuec8qJQzc4O5GsiEanAE104MiAcmVdk1wzuRVXAZHNZk pHHijNoJCtK9eEV3Cn4qRkAo+EAUAkE= X-Received: by 2002:aa7:dd05:: with SMTP id i5mr19191093edv.324.1597739723530; Tue, 18 Aug 2020 01:35:23 -0700 (PDT) Received: from ?IPv6:2a0b:e7c0:0:107::70f? ([2a0b:e7c0:0:107::70f]) by smtp.gmail.com with ESMTPSA id eb11sm9873077edb.76.2020.08.18.01.35.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 18 Aug 2020 01:35:22 -0700 (PDT) Subject: Re: [PATCH] tty: ipwireless: fix error handling To: Tong Zhang , jikos@kernel.org, dsterba@suse.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org References: <20200816074334.981915-1-ztong0001@gmail.com> From: Jiri Slaby Message-ID: Date: Tue, 18 Aug 2020 10:35:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200816074334.981915-1-ztong0001@gmail.com> Content-Type: text/plain; charset=iso-8859-2 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16. 08. 20, 9:43, Tong Zhang wrote: > ipwireless_send_packet() can only return 0 on success and -ENOMEM on > error, the caller should check non zero for error condition > > 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..b6f677f4004c 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) { More consistent (with the rest of the kernel), would be to check "< 0" in all the places. > 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..0230e0fd3937 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; > } > -- js suse labs