Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp391607lqt; Thu, 6 Jun 2024 06:51:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU/TJyTso4JsEpnG/7tgIaK805TPL69CpjMMKZighOm4fSYtJGZPPpOSksy3mAGUJ+ysuMVK0kiD9qzm4tiSEoLgOQZqExDEjik/x5Tww== X-Google-Smtp-Source: AGHT+IFi9Gweayqcjw4PsfsnmSEIoCBhimwuJSY7N2dxhVp427RJS/0IAj9Pjo0n4DKfHDhpAmJI X-Received: by 2002:a05:6358:cc20:b0:19f:339:7f45 with SMTP id e5c5f4694b2df-19f03397fecmr131767555d.4.1717681911807; Thu, 06 Jun 2024 06:51:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717681911; cv=pass; d=google.com; s=arc-20160816; b=Yo9xB7z5d8kUmVccZ8ha7c51skpNwhGjd4RtlNnfzH7nrLcsaQlPzQli/u3ghHkYvH NfGSvKL58UquhrHeSRQVmo1ZUpiMcyfMQkxDlTp///Gc2DvvRm7MhR/NPc86URZHh5rc WJgdiA5DOjFEpsOfrTwXUUUa9SBg8RhN1TojW5vabK7T/WgudNcJB5TKWUSqhVJqi8Fm 1AbWqXbAv+bKi6dhj4QNli8WVG0lAfWPKqzkDzmK0J3CC0yudOQOTI7NT9nZ4TcKqLAO X6bwn69DYkxNQpTInPjQcMbNX9dLWj/RR9vRVub9Vd6qaRNFfG1ym0UmrUqwxQlhYyM0 StUQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=jFUf6bMmExYUjpDZWm0bZPwqFQ07UEUAvkZsl43H4Os=; fh=ZZhwkgztOTK8tWkKs2QYBLgMT8gRYvAyTQwxHbXQfF8=; b=BURhJlYccH0z5KOfGAJlb3aNL/HHqYKgmVhH/2PhIWvCobZy60dsJJBaQ05vZBEPee 4hA3zCklVJsgGJGh6fbXQk9qpK8GzzgCJgSRKrT8lFSh/xuNbeIWT9SMFGgIUfpOZEka TVveWBTfdr1S1NYNYdW4REEi+/sJwqj/2V3PJvxVcyruZZ3OLagVgQJUjK+cf/z1sjVH T3dVzNFd/ztZ8+krvLJdi7aa3/OnX9LF8rTsmxPjN1hxB4ZQQ8Z3nBdVcpb6mrZTnW15 wz1HfpfquplB9wS+sQ0d8145Pebbl/cMFkuRLXAU0C3h9qCUCAgs+eQlVbQgKUDUYMTz EX8w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SmkWgd4t; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-204021-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204021-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de219796c6si1160636a12.243.2024.06.06.06.51.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:51:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204021-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SmkWgd4t; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-204021-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204021-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A2E3B283271 for ; Thu, 6 Jun 2024 09:36:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 42FF715279C; Thu, 6 Jun 2024 09:35:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="SmkWgd4t" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 07EA9152190; Thu, 6 Jun 2024 09:35:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717666537; cv=none; b=jHx9V63+Pba1RbTC69fQXe2EeWa7GU3nP0BIvPM7JjCorj7nnHxBP5SISoLMe9YSmee2IY3j5PpbZ9wFBnFmCGnFqRIq0oXr7vjY9bUUSt90cSJVgC4nr4IHIVO0Me9br4WkofN42sq+gewMbrjYb3ZULFw+ZBpiXH6e9p9scLQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717666537; c=relaxed/simple; bh=qNdgbtVZBhbRhwqW0g7Ha+IeNh5sfHj6cg5lKD8twg4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RQUctozUoc2Aq4eaVtfcG2EVknoO5vARR8sHKVi+KJKhSoTJMTSSrrnr76tr9BEVlzYJZdQSn0AQzA/jzszb/IRk+OfyQfDQ4PeHEH+laY9SPCbIb+P3ktcPWuzFWXZDn3B8wjUzkrlXXBXQi6pQbFTHhKYaWAcXo+lFGsyAafk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=SmkWgd4t; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717666536; x=1749202536; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=qNdgbtVZBhbRhwqW0g7Ha+IeNh5sfHj6cg5lKD8twg4=; b=SmkWgd4t5VL+XZXvB2aCL6Pam7iobeMRocwJf72Xz5s/hEM2HTPV+Vzg TrMwxryEM9gQhb+1f2k89rjzV5Al3531c4WFokZzgNlie9J2n1i6lWanI gjZvjiisCsgft92QesbFgyMBiy50Nh47nscYVXRvYm/UX4bTAQdQUSl3U jdWzvM8QFRJ5netP+Gx19ySxrAsdjUEmIl2JpLoQcnOa1Yg4Jz18vfXDC N2QcvQnMcBxrSaWusNa/22UThM4FIsQtS1O+WPGiANtrWg6ncO28QSOg8 SvF/d2wFVqH1ivOf4coH+7ZfPiK51Ejtx2gIGKBSwOBie/p5zhwn26cZf g==; X-CSE-ConnectionGUID: hSWJnq7aQVWn6yn86nm2IA== X-CSE-MsgGUID: V/G4l8pzSMW/8Qbmvr0q3Q== X-IronPort-AV: E=McAfee;i="6600,9927,11094"; a="24954363" X-IronPort-AV: E=Sophos;i="6.08,218,1712646000"; d="scan'208";a="24954363" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2024 02:35:35 -0700 X-CSE-ConnectionGUID: 2tRr+0PoSqK9jW5C7fhb0A== X-CSE-MsgGUID: zjSkyaT7Rzin2gbzg57M9w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,218,1712646000"; d="scan'208";a="42844311" Received: from kuha.fi.intel.com ([10.237.72.185]) by orviesa003.jf.intel.com with SMTP; 06 Jun 2024 02:35:33 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Thu, 06 Jun 2024 12:35:32 +0300 Date: Thu, 6 Jun 2024 12:35:32 +0300 From: Heikki Krogerus To: Javier Carrasco Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Julia Lawall Subject: Re: [PATCH 3/3] usb: typec: tipd: use min() to set tps6598x firmware packet size Message-ID: References: <20240606-tps6598x_fw_update_log-v1-0-2b5b8369a0ba@wolfvision.net> <20240606-tps6598x_fw_update_log-v1-3-2b5b8369a0ba@wolfvision.net> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240606-tps6598x_fw_update_log-v1-3-2b5b8369a0ba@wolfvision.net> On Thu, Jun 06, 2024 at 11:03:57AM +0200, Javier Carrasco wrote: > Simplify the current firmware packet size check in the tps6598x > implementation by means of a single call to min(), which is what the > current code does in a more verbose, less elegant way. > > This patch fixes a cocci warning ("WARNING opportunity for min()"). > > Suggested-by: Julia Lawall > Signed-off-by: Javier Carrasco Reviewed-by: Heikki Krogerus > --- > drivers/usb/typec/tipd/core.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c > index 58f6eeffd070..ea768b19a7f1 100644 > --- a/drivers/usb/typec/tipd/core.c > +++ b/drivers/usb/typec/tipd/core.c > @@ -1165,10 +1165,7 @@ static int tps6598x_apply_patch(struct tps6598x *tps) > > bytes_left = fw->size; > while (bytes_left) { > - if (bytes_left < TPS_MAX_LEN) > - in_len = bytes_left; > - else > - in_len = TPS_MAX_LEN; > + in_len = min(bytes_left, TPS_MAX_LEN); > ret = tps6598x_exec_cmd(tps, "PTCd", in_len, > fw->data + copied_bytes, > TPS_PTCD_OUT_BYTES, out); > > -- > 2.40.1 -- heikki