From patchwork Wed Sep 25 12:20:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: R Sundar X-Patchwork-Id: 13811991 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C60A18308D; Wed, 25 Sep 2024 12:20:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727266828; cv=none; b=OOqOkG0sJCfl9On1FnURa6On6Tb76UNR6VBkg3gWLYTiXeisJ/eIzMjUzmCw9uJYwKF0Jq08wpKuGla7IvYX8B3Na94IqIiCTyZQLJDDMaZwHB5VND/F1PDi93Y2bzC04vvv6SQjyDNJfWurlgGKOBK3b4SvVxouONt/zARAK6c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727266828; c=relaxed/simple; bh=BVIKs5p8wPKsIFFHc3VjmL08yvB077qRlK8Y/PX8C8o=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=gKpRweAKxLzk7i+ZCNLGtWDQcebQHCFgF3sPi7u4qs/4b2Ot1fR3SVWkaEwm07/0tkwEdVC/zZS/W6Yx455VGXH3zRiDvQ2OIpnYcBb01+KShGaW3JmGCdkeImhFPZjoBiu2kwVxivbnud75U5ENZ0C1s60XQvEbmjt1HaqHAxw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=H1q/HptG; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="H1q/HptG" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2054fea6f26so3751515ad.3; Wed, 25 Sep 2024 05:20:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727266825; x=1727871625; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=i7xNM0O+xbhrrlGWqxwznqgYdPW8etKAhMjyDgYMNtg=; b=H1q/HptG75zfbCM1n9ZvBxOFjVVH6YAYv/eNJh2nZHNXdaSqbPThjzH6FT7Fou7tsY A/N/oVhjpvKP9OGOq/YPCu5CYdduO7v+X2evNu2wKwVunLMgH1OOluY02rmDm6UjaDlL oH8+DD3SsQuMktc+3ZIDvgZolhOUKDyNpxSfQBlwKURqHHmhKPNpOqsNg7ulMpljNI6u SsjgJZH/odo16Wl+L+I85Mgs2o3pAbNechrP3NeZ45EEzYpivu9GIlfPwUC2KBnPnYVh UxyVKfZtijYJJLwlfbl2l9dbWnZam0AMVds76XKJtHHrJD/fxMc+fKj8+bcR+7XyAq3C Z/Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727266825; x=1727871625; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=i7xNM0O+xbhrrlGWqxwznqgYdPW8etKAhMjyDgYMNtg=; b=a7BWmrQftXlJBKPZgMK7vHR+KTBLp3Cb3FVGsxs32GCy38/wcFQ6U6V4VSZ16AggEN suqhdOybHVAc8pRfhatHy/tpHeFumSc5WZW5yPW97in6coU7gwb7xjIfrsZCIUU2hMPg yrKwC12C7FFvY4bi7rPvMsyuW/FRRuIoXUyAQgEAhbt9S44kBBquNGb5IskfMH4Dd3N3 uSnRfyGL9HSOyO/BOmPbEJEXe/UluYW0WlffAJRnF1cp05sLSh1hcs25e4kYTXvaPvQL TvVOxlr2KjUwcoBMvuDd9TO43avRU1127yV1PAo2Yb2TnbqwaJxSu4NomskS9FQITzDs 89Gw== X-Forwarded-Encrypted: i=1; AJvYcCXbPjK6YGIK+UeOnDYik2eR6My+dFYRv0JI4GPdj+DA7jcH4ogVGVjxgDnrWUdVwgUZnKeVqCZuKgScwjM=@vger.kernel.org X-Gm-Message-State: AOJu0YyUlpc0I9Bey6Ea+BLwfSYceLiyX2J2sZXG3JASykP/4y1G0C40 TmsgVu/+L27gmU6B1tUwB/TqCaci345hGcAuyvVQpj+IGMD2VovT X-Google-Smtp-Source: AGHT+IHGvAKGfvAdQGqJQCw1JRRow6WqXo0NzHxjsEuprOybsP/nV/XT83aPeA91DRD3TOjD7+9pYA== X-Received: by 2002:a17:902:d2cb:b0:205:8820:fe1c with SMTP id d9443c01a7336-20afc4ab338mr15208645ad.5.1727266825298; Wed, 25 Sep 2024 05:20:25 -0700 (PDT) Received: from dev.. ([2402:e280:214c:86:1869:2941:7f8f:86c7]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20b0df108ebsm5084265ad.266.2024.09.25.05.20.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2024 05:20:25 -0700 (PDT) From: R Sundar To: Heikki Krogerus , Greg Kroah-Hartman , RD Babiera , Guenter Roeck , Badhri Jagan Sridharan , Kyle Tso , Xu Yang Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, frank.wang@rock-chips.com, R Sundar , kernel test robot , Julia Lawall Subject: [PATCH linux-next] usb: typec: tcpm: use max() to get higher value Date: Wed, 25 Sep 2024 17:50:14 +0530 Message-Id: <20240925122014.552221-1-prosunofficial@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use max() for better readability and to fix cocci warnings. Reported-by: kernel test robot Reported-by: Julia Lawall Closes: https://lore.kernel.org/r/202409231009.2efXAh9b-lkp@intel.com/ Signed-off-by: R Sundar Reviewed-by: Heikki Krogerus --- Reported in linux repo. tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master cocci warnings: (new ones prefixed by >>) >> drivers/usb/typec/tcpm/tcpm.c:6356:20-21: WARNING opportunity for max() vim +6356 drivers/usb/typec/tcpm/tcpm.c compile-tested only. drivers/usb/typec/tcpm/tcpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index fc619478200f..aac4de1d53a8 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -7367,7 +7367,7 @@ static int tcpm_psy_get_input_power_limit(struct tcpm_port *port, src_mv = pdo_fixed_voltage(pdo); src_ma = pdo_max_current(pdo); tmp = src_mv * src_ma; - max_src_uw = tmp > max_src_uw ? tmp : max_src_uw; + max_src_uw = max(tmp, max_src_uw); } }