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 X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 305EAC31E5B for ; Tue, 18 Jun 2019 16:07:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F102120B1F for ; Tue, 18 Jun 2019 16:07:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560874022; bh=kYFiCLCeGJIrHbzMHz1SYuhG/cXC+BN+X0zJb7/77og=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=pSHZb1JZMD0mKld3uR5RVKaXV7YYgINoI9CmHJS+X3RcvkicZtwvVrKxoxaYbnwLc lncu/PpjlTxmcqQvDk/LdSa9c8FuIfY18kVeygJFN2VDuguOg3ixuiChs0ep0WYYtt j0WIRJB1KYJ2P556gKP8LpQpAJhclQXjH1WeHwb8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729541AbfFRQHB (ORCPT ); Tue, 18 Jun 2019 12:07:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:46924 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729507AbfFRQHB (ORCPT ); Tue, 18 Jun 2019 12:07:01 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 110D620B1F; Tue, 18 Jun 2019 16:06:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560874020; bh=kYFiCLCeGJIrHbzMHz1SYuhG/cXC+BN+X0zJb7/77og=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ARZhi1O+FJ+0gXyMib4C4LSGL6jJZiMslCjQQ+9wExkxfb3o69VKDndHxPhzQ/au+ cKhdF4AtYB2FkeRnG//lWQgyx1bc6uIFNLIjLMaUScphhIDowUihTkSqFWeHDPgQeB /in3qdmq0p3QZpt9hW4AROs/fTDtk6yyV27b5dlE= Date: Tue, 18 Jun 2019 18:06:58 +0200 From: Greg KH To: dmg@turingmachine.org Cc: linux-usb@vger.kernel.org Subject: Re: [PATCH] usb: Replace a < b ? a : b construct with min_t(type, a, b) in adutux driver Message-ID: <20190618160658.GA27611@kroah.com> References: <20190618153529.11418-1-dmg@turingmachine.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190618153529.11418-1-dmg@turingmachine.org> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Tue, Jun 18, 2019 at 08:35:29AM -0700, dmg@turingmachine.org wrote: > From: Daniel M German > > Use min_t to find the minimum of two values instead of using the ?: operator. > > We use min_t instead of min to avoid the compilation warning 'comparison of > distinct pointer types lacks a cast'. > > This change does not alter functionality. It is merely cosmetic intended to > improve the readability of the code. > > Signed-off-by: Daniel M German > --- > drivers/usb/misc/adutux.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c > index 9465fb95d70a..4a9fa3152f2a 100644 > --- a/drivers/usb/misc/adutux.c > +++ b/drivers/usb/misc/adutux.c > @@ -379,7 +379,7 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, > > if (data_in_secondary) { > /* drain secondary buffer */ > - int amount = bytes_to_read < data_in_secondary ? bytes_to_read : data_in_secondary; > + int amount = min_t(size_t, bytes_to_read, data_in_secondary); Shouldn't amount and data_in_secondary be of size_t type? Then you can just use min() here, right? thanks, greg k-h