Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp941677iob; Fri, 13 May 2022 17:13:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzPttrR76v1DfV1torUqEVo52NlqUyB9Zaau9ve99qtOhuI8om5KIQtnSrlXfoGj7lHkB4 X-Received: by 2002:a5d:6c64:0:b0:20c:d917:c1dc with SMTP id r4-20020a5d6c64000000b0020cd917c1dcmr5718832wrz.194.1652487181489; Fri, 13 May 2022 17:13:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652487181; cv=none; d=google.com; s=arc-20160816; b=qWlLGbAiQ+Z4/GvzhitGPUz2Rd18NKn19fGwAIEOjMPwo2GUKsaXA+RMaVClgPLOco VkYBKKsa+eU5Yo75sxltqCjiQfKJ3N+jX2Zs0bM2UXUtujHGoVaFR86PKqvcyxJkBO++ WM/Su0wRCaZoYQQzglxltGExWnLyCsZesZwPJ/7VntCmUH4RcS+yP1UML+5Y1kTSubUQ 8bprTj7xjZdew9lceCj3HZzqHaRa/FGDHwpCHIrSw0V9qvcSgaA8BUZ1jA1G3i4GMJdf Em+7Fb5xY5T26xHhtmiX+Z046aQjOWYJzceG0eWeSk1eS5/psGbwZR5Uaibeyj47xKN0 706g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=L9csMrQHLO+CDvFq/mI9IdOCZ9z7bCG8il9sn1VTWo8=; b=PFfCDYkLeRMtTcNyA5sG0bsjh+A24KSj1JZgneRSIDInlvM3QmIu9cc6xH9NCdzAkH oJIDgSj6mxRIsEXi0I+ekEbSrmfV+0MlfjxhPydrctV21M/k/JaG51gqL+Z31E5Sq/9r RhYBgUaS5CxDkbCulIUGqgn0AlAR/5r/PUMXdxtLhAY4xhm2LZFOG7dhudRTyJGqcnRz 6MVfCAds6xKQ+eo8OgPvO0sFChne48pMYLROrL/mT2xQeuRoeIbpIuiLpmdk+V9k9fEU SqyyIFh0VgT54N0DQIijxkuQHobBbJ9PIGYl6C9QrMoX9QQNwfe8kCfyX91klQG4PDCc B3KQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id u4-20020a056000160400b0020ac43c9436si3776305wrb.112.2022.05.13.17.13.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 17:13:01 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C2DFC31DEAF; Fri, 13 May 2022 16:14:03 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383497AbiEMS7P (ORCPT + 99 others); Fri, 13 May 2022 14:59:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240694AbiEMS7N (ORCPT ); Fri, 13 May 2022 14:59:13 -0400 Received: from mail.enpas.org (zhong.enpas.org [IPv6:2a03:4000:2:537::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5ECC852E51; Fri, 13 May 2022 11:59:11 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail.enpas.org (Postfix) with ESMTPSA id 0668AFFCE9; Fri, 13 May 2022 18:59:09 +0000 (UTC) Date: Fri, 13 May 2022 20:59:07 +0200 From: Max Staudt To: Vincent Mailhol Cc: Wolfgang Grandegger , Marc Kleine-Budde , linux-can@vger.kernel.org, Greg Kroah-Hartman , Oliver Neukum , linux-kernel@vger.kernel.org Subject: Re: [PATCH v6] can, tty: can327 CAN/ldisc driver for ELM327 based OBD-II adapters Message-ID: <20220513205907.6d5473ff.max@enpas.org> In-Reply-To: References: <20220512182921.193462-1-max@enpas.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 13 May 2022 15:31:20 +0900 Vincent Mailhol wrote: > On Fri. 13 May 2022 at 11:38, Vincent Mailhol > wrote: [...] > > > + case ELM327_STATE_RECEIVING: > > > + /* Find delimiting feedback lines. */ > > > + for (len = 0; > > > + (len < elm->rxfill) && (elm->rxbuf[len] != > > > '\r'); > > > + len++) { > > > + /* empty loop */ > > > > Question of taste but would prefer a while look with the len++ in > > the body (if you prefer to do as above, no need to argue, just keep > > it like it is). > > Actually, what about this? > > len = strnchr(elm->rxbuf, elm->rxfill, '\r'); Actually I'd use memchr() if anything, but not really here. I do end up using the actual index. And since both strchr() and mrmchr() return pointers, I'd rather avoid them because I prefer to use indices whenever possible. Max