All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] Input: remove a redundant max() call.
@ 2013-10-31  7:26 Kang Hu
  2013-10-31  7:48 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Kang Hu @ 2013-10-31  7:26 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input, linux-kernel, Kang Hu

dev->hint_events_per_packet is guaranteed to be >= packet_size.
so an extra max() call is not needed.

Signed-off-by: Kang Hu <hukangustc@gmail.com>
---
 drivers/input/input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index c044699..fb513da 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -2048,7 +2048,7 @@ int input_register_device(struct input_dev *dev)
 	if (dev->hint_events_per_packet < packet_size)
 		dev->hint_events_per_packet = packet_size;
 
-	dev->max_vals = max(dev->hint_events_per_packet, packet_size) + 2;
+	dev->max_vals = dev->hint_events_per_packet + 2;
 	dev->vals = kcalloc(dev->max_vals, sizeof(*dev->vals), GFP_KERNEL);
 	if (!dev->vals) {
 		error = -ENOMEM;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] Input: remove a redundant max() call.
  2013-10-31  7:26 [PATCH 1/1] Input: remove a redundant max() call Kang Hu
@ 2013-10-31  7:48 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2013-10-31  7:48 UTC (permalink / raw)
  To: Kang Hu; +Cc: linux-input, linux-kernel

On Thu, Oct 31, 2013 at 03:26:34PM +0800, Kang Hu wrote:
> dev->hint_events_per_packet is guaranteed to be >= packet_size.
> so an extra max() call is not needed.


Applied, thank you.

> 
> Signed-off-by: Kang Hu <hukangustc@gmail.com>
> ---
>  drivers/input/input.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/input.c b/drivers/input/input.c
> index c044699..fb513da 100644
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -2048,7 +2048,7 @@ int input_register_device(struct input_dev *dev)
>  	if (dev->hint_events_per_packet < packet_size)
>  		dev->hint_events_per_packet = packet_size;
>  
> -	dev->max_vals = max(dev->hint_events_per_packet, packet_size) + 2;
> +	dev->max_vals = dev->hint_events_per_packet + 2;
>  	dev->vals = kcalloc(dev->max_vals, sizeof(*dev->vals), GFP_KERNEL);
>  	if (!dev->vals) {
>  		error = -ENOMEM;
> -- 
> 1.8.3.1
> 

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-31  7:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-31  7:26 [PATCH 1/1] Input: remove a redundant max() call Kang Hu
2013-10-31  7:48 ` Dmitry Torokhov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.