From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A44E1298984; Tue, 15 Jul 2025 18:43:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752604982; cv=none; b=KYF73B361CCOk07WZU8xgME8Hgm0q+Cc3K9VP5cUgr7Z2aUkt8DQ/umGJV26xKax9vNratE1Iq5thzwipQ74PuYwGd2GaV95/A++pQahy/mYKA2GVVUnBrc6BpVjC1FyRSh7pW4QYpLTtj0R3D9sHvMyhLDcw2v/QGwbYyrNsrk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752604982; c=relaxed/simple; bh=3Sk8OD1GPqm014HeEtd4jh5A62bNxih3I2406/Aru7A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Glf5MzlAFSXuRHNTfSz1/PfnMkw2I3pzRmtWl8UOV1zf4R0TIiObaAWTbu5pzA4TxBdJCvMrGWxg0N6ulidgHnKLGMOnQoJW5TF/n0ZokGDP+WYOLEwufS/btjw0qsMKFBtyd8D+Z6U/cP8XA5afhPzXrQpeRIO0Xo6m3hwrtPk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=LpY6pURJ; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="LpY6pURJ" Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 604B578E; Tue, 15 Jul 2025 20:42:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1752604946; bh=3Sk8OD1GPqm014HeEtd4jh5A62bNxih3I2406/Aru7A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LpY6pURJoVzQ3RyVwnojcld6jswGontVdnJOuUPiIyk5T89kBkemJjRdCYy7L3Q45 G1I2kdZ4d4WAv4hIcC0ZHPjXnXWGNV1O9iw/K99tffQGWNIoiVc/Z/Hg98rGZetswa r99MzFp+kJoToaGGjDa+SAIi2u2XweSE90HhQw6Y= Date: Tue, 15 Jul 2025 21:42:57 +0300 From: Laurent Pinchart To: Darshan Rathod Cc: Hans de Goede , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] media: uvcvideo: Fix assignment in if condition Message-ID: <20250715184257.GM20231@pendragon.ideasonboard.com> References: <20250715113056.2519-1-darshanrathod475@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20250715113056.2519-1-darshanrathod475@gmail.com> Hi Darshan, Thank you for the patch. On Tue, Jul 15, 2025 at 11:30:56AM +0000, Darshan Rathod wrote: > The function uvc_input_init() used an assignment of the return value s/used/uses/ > of input_register_device() within the condition of an if statement. > > This coding style is discouraged by the Linux kernel coding style guide > as it can be confused with a comparison and hide potential bugs. > The checkpatch.pl script flags this as an error: > "ERROR: do not use assignment in if condition" > > Separate the assignment into its own statement before the conditional > check to improve code readability and adhere to the kernel's > coding standards. > > Signed-off-by: Darshan Rathod Reviewed-by: Laurent Pinchart I'll update the commit message as mentioned above when applying, no need for a v2. > --- > drivers/media/usb/uvc/uvc_status.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/usb/uvc/uvc_status.c b/drivers/media/usb/uvc/uvc_status.c > index ee01dce4b783..3c29c0bb3f7c 100644 > --- a/drivers/media/usb/uvc/uvc_status.c > +++ b/drivers/media/usb/uvc/uvc_status.c > @@ -62,7 +62,8 @@ static int uvc_input_init(struct uvc_device *dev) > __set_bit(EV_KEY, input->evbit); > __set_bit(KEY_CAMERA, input->keybit); > > - if ((ret = input_register_device(input)) < 0) > + ret = input_register_device(input); > + if (ret < 0) > goto error; > > dev->input = input; -- Regards, Laurent Pinchart