Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1519293pxb; Fri, 26 Feb 2021 12:58:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJxiIFL6YxvYhlpSt0HrwJtc/X530F1ZKaxVssi3FE8edYMQ/ybtsSLR+E14BCsj86yvKG1t X-Received: by 2002:a05:6402:b70:: with SMTP id cb16mr4214432edb.11.1614373105692; Fri, 26 Feb 2021 12:58:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614373105; cv=none; d=google.com; s=arc-20160816; b=dTdBrtAGCUqJj3ai75+wMFAO8ycVTq3vHKqLkzeaoL09nL4enJs0xucj5otd/HoifS w4GDaLuKjSAsSgREKiofadwTQQRH/5bc3pLj2vTEqpPvMP2Iv9bMIiBCjBrLs7zS/q05 OPGVPzSQ3d8GPxsmW0yTqeZe8xU9jOfXliT4WqGpB3hCLN0JL+vvTjcmQUQmTIqN5i0+ wsL1d+6GWwpkPuNN7JmJ18iKLWsJiYHkEVWcycXUGb7Ur6wa5LhiToTUkm3C/DJtIAO9 b5QSPHqRCfCDDWb1puv65tJE0jRdtUCDwo7O85J6yM7jChiEb+tfj5zpPFsyxcjowqCn M9Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=luqx3cU12gW6l31P+oloN1EmDovQOrEz+j/E4ZvRIEo=; b=YAWDh39zXhF77XKyraomoj3SaUFopp01no8AK/3SKOAMn2mu1ndPgQmlpDkslSARFN AnKNxe5tb8n6e+UdeLcXJuTjpNkWRfZNszX82yNbfsmPL7EXX2NU/xaua8pDAA2owTwa QoS/TMcwoSZyjVQNkTOh1PHa8dxcXWIAChVGhKKTLikCkgJgBwdDwt49aQUJPxE6d9H2 e8o3bxD7hWJO1rWfytdwjeIMaEV8aL0CJLTsWENVNWlsDGi7cxY/1C5xK6N2W7kxqs/n SCn7f07IR+dJ5dCgoDfLYDhwiPpSx0tVxRtLJqeeNHynPyiSs0oi2BsBlx4aqQWgWX2K I58g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=N7R0KM77; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o11si3743549ejb.453.2021.02.26.12.58.03; Fri, 26 Feb 2021 12:58:25 -0800 (PST) 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=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=N7R0KM77; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230375AbhBZU4W (ORCPT + 99 others); Fri, 26 Feb 2021 15:56:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230079AbhBZU4S (ORCPT ); Fri, 26 Feb 2021 15:56:18 -0500 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAB86C061756 for ; Fri, 26 Feb 2021 12:55:37 -0800 (PST) Received: by mail-ej1-x62a.google.com with SMTP id do6so17000429ejc.3 for ; Fri, 26 Feb 2021 12:55:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=luqx3cU12gW6l31P+oloN1EmDovQOrEz+j/E4ZvRIEo=; b=N7R0KM77yXb5Q4ragmQ+c1Y18LNttK0H8Cf8chtF14NxpHhnVDeUleN04i4hEhbR39 UqiPg2hPKRLhazAGbUZ2TXVYGcOWmxqVDPigh59vyQmi0wpK9Mr91l059lpTPnmQqfQo bSFd/tb6HrzZfMhv5XrmNopU/03Z5fm+xgPxkiQdjc6tB60kpV+AU3jpq+HYgh9YDr5/ JQJWihoPjw+V5WP33x63wwKHUWc42EixYD45J/Zx6H4Af/gNIfRHLORqGp6ghPnsaAzA oTYgdy5TFzXMi7lH4f+Fkai9dMUGP6TUwiLbdRQFofkI5qMJ7iEjWQGqTcs4J1X5FzwN jMLg== 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=luqx3cU12gW6l31P+oloN1EmDovQOrEz+j/E4ZvRIEo=; b=sJzc9hyU6H7GaW90d6s9vtgOoY53dvfg/TN4Fb9IVluTEvNKgSOiRksmGDnM7Qy9zo PidT0Ze8yQYFJvvHWZ8xlQA9wtUS/wGsTJIEYL2Mku9TsmWFCTCDHT93X3xF86WRcXfy TVX+SFH7x+j5nkSfeunl3Ec39PTngKCMte6Jhr6ow1BS+x+508Pwu8IDxlTxGlj2uOCJ oi18K7JM/FEzaPF6pqjydoRxRYnqmJgQZ2EVUddu9V+cqoluqMw4My3rlD32ArYeSSyp TQcsEQj1yV2Vwv19G+ZUqm/7hDk/OykFyfJyELaPdHyewiqUkMdEQcPap3aA/thkerqm Ev3w== X-Gm-Message-State: AOAM532GgRJu3H7mZZar/ElqNRn6Qm9KUoETBsg2QnZGf4gqRkIK6FTy wSxYk+TCPS2yIEXhBXmYjhgFdBQ4FwHlm9Q/mrXQ/w== X-Received: by 2002:a17:906:ae88:: with SMTP id md8mr5230087ejb.264.1614372936636; Fri, 26 Feb 2021 12:55:36 -0800 (PST) MIME-Version: 1.0 References: <20210226204552.45399-1-konrad.wilk@oracle.com> <20210226204552.45399-2-konrad.wilk@oracle.com> In-Reply-To: <20210226204552.45399-2-konrad.wilk@oracle.com> From: Dan Williams Date: Fri, 26 Feb 2021 12:55:25 -0800 Message-ID: Subject: Re: [PATCH] cxl: Make loop variable be 'i' instead of 'j' To: Konrad Rzeszutek Wilk Cc: "Schofield, Alison" , Vishal L Verma , "Weiny, Ira" , Ben Widawsky , linux-cxl@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 26, 2021 at 12:46 PM Konrad Rzeszutek Wilk wrote: > Hey, Konrad, thanks for fixing this up. Some more cosmetic changes to fold in below... > .. otherwise people spend extra cycles looking for the > inner loop and wondering 'why j'? > > This was an over-sight when initial work was rebased s/over-sight/oversight/ > so lets fix it here. s/lets/let's/ > Fixes: 583fa5e71cae ("cxl/mem: Add basic IOCTL interface") Since it's just cosmetic, I don't think it needs a "Fixes:". The AUTOSEL-bot need not worry about this. > Signed-off-by: Konrad Rzeszutek Wilk > --- > drivers/cxl/mem.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/cxl/mem.c b/drivers/cxl/mem.c > index 244cb7d89678..2b8265b03b0d 100644 > --- a/drivers/cxl/mem.c > +++ b/drivers/cxl/mem.c > @@ -698,7 +698,7 @@ static int cxl_query_cmd(struct cxl_memdev *cxlmd, > struct device *dev = &cxlmd->dev; > struct cxl_mem_command *cmd; > u32 n_commands; > - int j = 0; > + int i = 0; Let's move this initialization down to right before the loop. If this ever gets refactored and @i gets reused this will break. > > dev_dbg(dev, "Query IOCTL\n"); > > @@ -716,10 +716,10 @@ static int cxl_query_cmd(struct cxl_memdev *cxlmd, > cxl_for_each_cmd(cmd) { > const struct cxl_command_info *info = &cmd->info; > > - if (copy_to_user(&q->commands[j++], info, sizeof(*info))) > + if (copy_to_user(&q->commands[i++], info, sizeof(*info))) > return -EFAULT; > > - if (j == n_commands) > + if (i == n_commands) > break; > } > > -- > 2.13.6 >