Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp767947pxa; Wed, 19 Aug 2020 14:30:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDUCqi/TVfH3Ygfqxt0RCjjuXYfAnEcmQHiz9AddB9zUKetP5MURWYv2O4FDxOFNQxrzOz X-Received: by 2002:a17:907:1191:: with SMTP id uz17mr322894ejb.184.1597872644730; Wed, 19 Aug 2020 14:30:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597872644; cv=none; d=google.com; s=arc-20160816; b=ODPoai6/XVUjEwHbKcX4fD6uzRFxaQTYvj/d98fDNiPyCLYy8C3fJ3AcJcVht9hnPQ 3NyW0XShNDG6W+hpGO/oWyLRJ78+BRvZYdKj2C40Th92E5IdRebggICcFBjEjWLcMGjc +t1SQ0FVhZFwSMvuYNHX0u9KX8KZK+xf1wJt9HiebWh8IM1x4UHvnJa2mneeOtNjWNmj gCSNup3HG9kUUrHiq+/Ect31s/RDGkIXiB49+/bJqSbgIWbEHZEyjEj0U+YawebOlyO0 NFmRzkuO+HLcC/s2sWBtNedzhh1x11fDw4bGt4iUADx6OwKUKXQ79Ug8YC4MYW+8RG3I TL0Q== 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=MRA2y2Rc3TNgmf0EPNyuX2jexuAJTmfYlCYdqUjzR5s=; b=BoGnt1/abg5+wb7G3pUSUivmxYwHvtvC2zrmkz2NZQc2PCqAFm7Iz2w9z0On8dIJgh FGXrZ18Q73yKFMzNBGQDcG2jdkBWGoTuwNh4h+IwlVXh/L1NHfRX2pvNjUz4s3ZDTOjR 87KLMKlOJKKv7Vw7EhP/VuOLy2dkwNVGImw5iTmMhBa2V60QPpxtrEMFTz+VEVbx2BEy NE+birn22QlIfNLQHUSH72+mme+mjsanup0MkbctP4bUOGqf5kxjpJ0aL/jDBL9a9nRC BdByHaFVVu9+Ecrbx4yhQq6VorUOmXSX+GiVB2YZ4GGC+tLTmQtlypAHH6SmTDLLl14w AnRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="afydlD/U"; 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 o5si16136868ejx.202.2020.08.19.14.30.21; Wed, 19 Aug 2020 14:30:44 -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="afydlD/U"; 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 S1727782AbgHSV1O (ORCPT + 99 others); Wed, 19 Aug 2020 17:27:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726967AbgHSV1I (ORCPT ); Wed, 19 Aug 2020 17:27:08 -0400 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 419EEC061757; Wed, 19 Aug 2020 14:27:08 -0700 (PDT) Received: by mail-il1-x142.google.com with SMTP id z3so14406ilh.3; Wed, 19 Aug 2020 14:27:08 -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=MRA2y2Rc3TNgmf0EPNyuX2jexuAJTmfYlCYdqUjzR5s=; b=afydlD/UDkiT1FrB2cVck24DWjkDau6bOedyxgqXyMAGc+9I6GDuT0drtfUqm2cNza Uz5jDPRu1SIKSiAYvzrwbZfJxaWBU1sTXIZRbksyD4T9Lr2l2n5LodTbFXJfQvRsmRLo rTr8e4d9ybaz9Sp8hqITCGU0NTtS6rtmmxJoHchCiG5iNuAKFR/9/D1m6XlLO1fO3R+e JwH7xdga44+RiOPIttXVAN7TRnkWToe1r7HRF3D4AllV0xujVmRnim9A3yvLpNNV9fHX TmuWFWh4YZO5yAExm4yT+zd2GkN38pVHPMIHOinidLzrdFPTBMHTNwOzGa6Np7M9JC/e C1GA== 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=MRA2y2Rc3TNgmf0EPNyuX2jexuAJTmfYlCYdqUjzR5s=; b=q8HnO36UbkGteQCfzLVaQmWhuaCdhbFV41eOslMjHBbB8U+uF+qHVL3iH1IXDfspHf tQj9+DI+Fgx1EVkYIWyskfiiXz2M3/v+qZYyxgAW6/VUqqOibBnBJe3g9DUuUUapDVgd zAZL9vAviMBsLmH1lsjv8M26UrelccAmj7aXS9j66XlDgGSHHuMj5kWyNjE0pgxlBzqb i3PfxTCA9z/YggJfHrY4wEySP5D9q1hOPk+S/TwQmT8LN8w483DdbQuRhpmM4yZJL7J4 /yVRNH/FG0SFPrX/P9CxZ3Tghks3H1zd+ynLEo9tiehCa5AJDRXSSURoqpGOQDqC0NH3 ur1A== X-Gm-Message-State: AOAM530R5qaV1hFcjKyUraP1x29C1kAL0YLqvK6dw+PQ16T4oN8tGD2V aV6+E1yFQobOTVycolWXJmJgvvWKq8zwNNfeTso= X-Received: by 2002:a92:8550:: with SMTP id f77mr23142957ilh.129.1597872426998; Wed, 19 Aug 2020 14:27:06 -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 17:26:56 -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, I just made another patch as suggested, I think I need some more work on the commit log. Please take a look and let me know - 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; > > >