Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp596446pxa; Wed, 19 Aug 2020 09:38:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+k6urapiVy1SNCcgSVx2vXT9ZCq8OybeVKlMXYaFtpA5imYLHEQTswhlofzBp4Lu4/tFN X-Received: by 2002:aa7:db50:: with SMTP id n16mr24601171edt.292.1597855106166; Wed, 19 Aug 2020 09:38:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597855106; cv=none; d=google.com; s=arc-20160816; b=jKMkScxXZB1tnrw8DNEejwnrzVXTx7uwGlBfj2VgUdb2QGmbbv7gEOnizhThGywANT aWRXzH5lbz5WdFQWp7Qfz2x659/Qgg0/I13DtTudY7iMOj8TzejgGKEYNAzpEjQeLfk9 AA5jfsMnop1s3WLcBeH3vbWBRH1/vZwmz+9hn12vf5+DCe3Gd1HiqWnY5gxIDI7Dd1P1 +zjNcF6/GLuxQF3MyOe4EEQVPBUd77h4sKzCgq0SULvqIDwmydtfMEHJmXOVMod77chb jysirJevL8y0m1/cYnMxm/puFa+6rXz7L4jL8XmsxwTdZJyBLDGs9AyXWuViuTylg5DK 9q4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=S0X/vbriFVnWWVZ5CjN02GNpsIqupceWmrYzbhZ7QUo=; b=YUfWd0EE2pcMMEhRrnjT6krqFOGRBQGXg5RlgaZ6h6cZRuZ9TLRKDCjkvF6ACe1Iyx J40JXmhR6OLljqCL4S9mSeOsMKijKLxZwWTBSiqtdPfBwVf0z4qaHYwFIBDc5MYdmizc VNJdONyJkvLou5tph60AKTcm2IqzOTxgFUxC2L0ZS8Yur5xokwJqmGJB6nqfJ6tDvVph 7XxBeWaZoadSDgtp5z7isLaqF+kFksg+9r0Xw1ZirCVTQkHxcp9Lr1PwHgSv3Y5c98ow xfWnK4+n67YByz5dOI3gS6tOWkxE4t6eNfvs89YlZ+K732vnUZhSP0sD6akEsxRqqGAG FwHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kxXLwp55; 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 qt15si15602183ejb.319.2020.08.19.09.38.01; Wed, 19 Aug 2020 09:38:26 -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=kxXLwp55; 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 S1726685AbgHSQhe (ORCPT + 99 others); Wed, 19 Aug 2020 12:37:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725939AbgHSQhc (ORCPT ); Wed, 19 Aug 2020 12:37:32 -0400 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADE59C061757; Wed, 19 Aug 2020 09:37:31 -0700 (PDT) Received: by mail-io1-xd44.google.com with SMTP id v6so25253073iow.11; Wed, 19 Aug 2020 09:37:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=S0X/vbriFVnWWVZ5CjN02GNpsIqupceWmrYzbhZ7QUo=; b=kxXLwp558f4WUskUKC2YtyusCu2kJ76eIdjy8pThlVKpa4Px4X5RZKR8ctMjEWU0iE tPNiT87Mcj97vH0O7J0p1yIejp25/GM06hu5c+ts9U1UxNk1vOL03DPDVidKS9oTZAtr M2skvcTVA1ufmtbR6/knE1V4Dn7eEWQoueLQLWcqKPH6ZrRLSQU0jki/FHCkvjrJuhlQ uwE19BnTWFr7peo0uRnfIBONCXFJCqZQh/CN4L2BbYU+/bfUeF2pal9KSwCbxzd4XRVB hUU3L/Ob04dwgM9bimBln9Pjlc63IEGogA6y6/pEj8Nn7rYo/RLk/6MhV1DZ4JhRP5Dj kVvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=S0X/vbriFVnWWVZ5CjN02GNpsIqupceWmrYzbhZ7QUo=; b=bsfu2+FxdhSpUiRkKPHr/wrUVl4rmJ7TFXD03Fch3OeuWSSBJDiNPPxbPGb79RMzI3 wpR+BOncyxN42cDgUE1wMDWpRVjKCIPKWv4QzA7rtPNyyHysV5m8X9Wuu9nO+icT+OdI srJzK5b1H3E3FV8uYzwXhZWk+MsYxFlcjY8LulD76XlQGtzv2L3LZQYTfJ4Tj6ukCwHD sQvKwQcc7fEqJFgwpnAcqGYjd70nxNJ39tEjeyf76GQb2AScY9MiOYcol9SkdfTZ3rZZ DU/+R7Kz9J9XsdXB1HuWvUhkwFlPK+ce9LxZzFYI/b7JLTaXoGwu96DrjlyZ37ufM5vJ TZxQ== X-Gm-Message-State: AOAM531L0OYEtr4hHhVI3+87O2nlZJfRL3Shvu6d2bNWh+LWTETPy0Pe OeFl4xqglG3CKllS2zMFG76jgPHhFx8Syy9hfVU= X-Received: by 2002:a6b:7d42:: with SMTP id d2mr21173344ioq.17.1597855050836; Wed, 19 Aug 2020 09:37:30 -0700 (PDT) MIME-Version: 1.0 References: <20200816064901.977682-1-ztong0001@gmail.com> <75b8354b-362a-0215-8038-45bd68be7de5@xs4all.nl> In-Reply-To: <75b8354b-362a-0215-8038-45bd68be7de5@xs4all.nl> From: Tong Zhang Date: Wed, 19 Aug 2020 12:37:20 -0400 Message-ID: Subject: Re: [PATCH] media: pvrusb2: fix parsing error To: Hans Verkuil Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, mchehab@kernel.org, isely@pobox.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Hans, Thank you very much for your comments. The change looks good to me. -- However, I'm not quite familiar with the patch submission process in this situation. Would you like to go ahead and create an improved version? Thanks, - Tong On Wed, Aug 19, 2020 at 10:38 AM Hans Verkuil wrote: > > Hi Tong, > > On 16/08/2020 08:49, Tong Zhang wrote: > > pvr2_std_str_to_id() returns 0 on failure and 1 on success, > > however the caller is checking failure case using <0 > > > > Signed-off-by: Tong Zhang > > --- > > drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c > > index 1cfb7cf64131..db5aa66c1936 100644 > > --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c > > +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c > > @@ -867,7 +867,8 @@ static int ctrl_std_sym_to_val(struct pvr2_ctrl *cptr, > > int ret; > > v4l2_std_id id; > > ret = pvr2_std_str_to_id(&id,bufPtr,bufSize); > > - if (ret < 0) return ret; > > + if (ret == 0) > > + return ret; > > But now you return 0 instead of an error when pvr2_std_str_to_id failed. > > Just do this: > > if (!pvr2_std_str_to_id(&id,bufPtr,bufSize)) > return -EINVAL; > > And you can drop the ret variable as well since that's no longer needed. > > Regards, > > Hans > > > if (mskp) *mskp = id; > > if (valp) *valp = id; > > return 0; > > >