From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34D49C0015E for ; Tue, 15 Aug 2023 21:08:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239974AbjHOVHi (ORCPT ); Tue, 15 Aug 2023 17:07:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239997AbjHOVHH (ORCPT ); Tue, 15 Aug 2023 17:07:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39F8A1B2; Tue, 15 Aug 2023 14:07:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CBE7D659BB; Tue, 15 Aug 2023 21:07:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D912AC433CA; Tue, 15 Aug 2023 21:07:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1692133625; bh=aUjeA8TDXxec5uQfQ22Hm9VJ5mfTMfSZTvWkNRoYaHs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=C24SITg5PXu6rhloJjEou7wk7y6Jt2ocA9i7owyx947HN1EhagcPg5cvRhPuLcAw2 FyHeKqt21GrTNg9pxMgzUFJ/7/Abt4tg0NfMGFV6stw+Aq+n44sUMxE/eyKZpwo+ri JpDm7d/H54/gj8j9ARNnZ3hLy/px/Lg127Pt7gbA= Date: Tue, 15 Aug 2023 23:07:02 +0200 From: Greg KH To: Atul Kumar Pant Cc: richard.leitner@linux.dev, wsa+renesas@sang-engineering.com, mhocko@suse.com, surenb@google.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, shuah@kernel.org Subject: Re: [PATCH v1] drivers: usb: Removes use of assignment in if condition Message-ID: <2023081550-absurd-sprint-65e5@gregkh> References: <20230815204141.51972-1-atulpant.linux@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230815204141.51972-1-atulpant.linux@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Wed, Aug 16, 2023 at 02:11:41AM +0530, Atul Kumar Pant wrote: > This patch fixes following checkpatch.pl issue: > ERROR: do not use assignment in if condition > > Signed-off-by: Atul Kumar Pant > --- > drivers/usb/core/devio.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c > index e501a03d6c70..56899fed6bd4 100644 > --- a/drivers/usb/core/devio.c > +++ b/drivers/usb/core/devio.c > @@ -2333,9 +2333,10 @@ static int proc_ioctl(struct usb_dev_state *ps, struct usbdevfs_ioctl *ctl) > } > } > > + intf = usb_ifnum_to_if(ps->dev, ctl->ifno); > if (ps->dev->state != USB_STATE_CONFIGURED) > retval = -EHOSTUNREACH; > - else if (!(intf = usb_ifnum_to_if(ps->dev, ctl->ifno))) > + else if (!intf) Did you mean to change the logic here by doing the calculation always? Does that change functionality? The existing code is fine, running checkpatch on code outside of drivers/staging/ or on new patches you are writing, is generally discouraged as the code usually is older than checkpatch is :) thanks, greg k-h