Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp515166pxa; Wed, 19 Aug 2020 07:42:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPU4JBSsIYODf+N9DEvFLdGjvwJtp8MIcgBPoUfp7zf7Gbq9s+sXoJi3myDkk1D2Ey+ie4 X-Received: by 2002:aa7:d7d7:: with SMTP id e23mr24086678eds.347.1597848121449; Wed, 19 Aug 2020 07:42:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597848121; cv=none; d=google.com; s=arc-20160816; b=kJhSCt4WX2kNl1ndz3oRgscoc5DDytnYHYhYMjZCUa1j1an4Hilc8/uDFuHc8xdFAG zps4X0AGL0aUSpSMRnRK+iZAd45RUfe/Ja9LeK+9hf2vNWYv9d0uofqQV5kn0bfKZCVD N08GFHh7JMTJ340RytAKVn/rLiJvi91rD9Xf8mCc0Coi+ZA65naJZFaNawPn6rIUy4Mg 71eROpEFBpwCil5NWNIRVrhuBI35Mh/KynGJC3ysix9cjhxPA5NKpnfr+pvic8NHf85Q FgfilIExdzgGBGd9kj29ngaivY2LWyPL/J3xzYAXJaR+2Uf7fH+l/6/XKbaoyKba24tz x7bA== 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:dkim-signature; bh=ZCCtfWWwbC+xmzzR83OhJZTEWK6QQn8jjpzmrcAeEqo=; b=ng5T/0Ie9+3f5ZMNPr2Cq+IBCPM+Y9T8tBC/86wvjCaiWl8XSCaHOnok4/nxoQBaWf xxxuaZylvRbqeTWAwXcWRzCP66o0joRRQ47DkPid4v/aMk84DoNaykLV90RfgdpW/mWc DEn2SfNp4zTmtZXJhr2JjGVBiDksvONUbbKypE+xPvJazlCwJPpEe0f3J/F3YlzBg6U/ rnb34A//VedvuWAfUiVsZBc/QaFCBpSY4ERvIQ2aIgkXxEB3ygXLPKdPfyn7reZ0Avol HE/Ap1oNcTbgxg1T56eKT6CwZfcq+ItpRA0fR75bGLIiUVHJh0oFKOKHm6TRsuZeOVRz YICw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xs4all.nl header.s=s1 header.b=ZkihLY9q; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c5si15492010ejm.274.2020.08.19.07.41.36; Wed, 19 Aug 2020 07:42:01 -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=@xs4all.nl header.s=s1 header.b=ZkihLY9q; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728335AbgHSOiF (ORCPT + 99 others); Wed, 19 Aug 2020 10:38:05 -0400 Received: from lb2-smtp-cloud9.xs4all.net ([194.109.24.26]:44285 "EHLO lb2-smtp-cloud9.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727000AbgHSOiD (ORCPT ); Wed, 19 Aug 2020 10:38:03 -0400 Received: from cust-b5b5937f ([IPv6:fc0c:c16d:66b8:757f:c639:739b:9d66:799d]) by smtp-cloud9.xs4all.net with ESMTPA id 8PE0kdShfuuXO8PE1khbsC; Wed, 19 Aug 2020 16:38:01 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xs4all.nl; s=s1; t=1597847881; bh=ZCCtfWWwbC+xmzzR83OhJZTEWK6QQn8jjpzmrcAeEqo=; h=Subject:To:From:Message-ID:Date:MIME-Version:Content-Type:From: Subject; b=ZkihLY9qrlW1OU5Q12mGO5KUwgY42fO1fBmQb2UWDMidlXxka6ypkfIUgocS8agPZ 8+oTmpUFAGNfr+Fw8mNQfqf3KfGmrFx/7j/XcHK+o6Ru+QU0aQcjWcykssfcBQbHM0 u0atx3ZcnTqS6eUsMqkTYQVvwBWpIj9sdMdM5iqCWy5NQ7DAi5Dfb9L9miYTVY1oxj hfZgp+0pzi2BQd7rvHXp1KCmi1LCj45OzH0m2Jihq1QL421JswXKMgSQEW+n/KnmbO aXo5jzQUk3r2t2ffU9ekFfa1epc7T10Yp/2+XzMWmGu8X8mScVgbxgijZdBNisAwwu G/ur+uz6Q+Ocg== Subject: Re: [PATCH] media: pvrusb2: fix parsing error To: Tong Zhang , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, mchehab@kernel.org, isely@pobox.com References: <20200816064901.977682-1-ztong0001@gmail.com> From: Hans Verkuil Message-ID: <75b8354b-362a-0215-8038-45bd68be7de5@xs4all.nl> Date: Wed, 19 Aug 2020 16:38:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200816064901.977682-1-ztong0001@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfHBMkT9YYsm1Z+wBgCVQqK/RITDoBMSaHCcElI+SP3gEA+4WuWQvrO+BAfDvPtuTQ2KwE3ANSM3Jy/EmuP+CiEljDI5C0ZTqmr2YgzbNqz6jLJJKJ7BF E8eXmk8xbB+2jTwlUl84VX2uZlgw0Nt0c0V5f59qqYWtYNKz+ZSWBnJnRsspakBYW3Y0W8blUDthIu2/io2LMuSo+HPTNEgCj4E0COzXgnbRb44J8rUIfdFm v5R+csIEJ6Me3zkwDMlLCEJryNgqooEXtPysFsRaAYykauNryG0NLplEvVF9q236bGMwa4PEBJMqgCasn5nIobIYAdttDXRm53mb+7pgL1b3k9FyQ1S0W2v1 HxHIgyic01HxTSBk0yXiscsEgYNyTTgRBreqsMj0+KmMT6Eqvxs= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; >