Re: [PATCH] input/mouse/elantech.c: Remove trackpoint related label

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Jul 23 2016 or thereabouts, Marcos Paulo de Souza wrote:
> by rearranging the code to release the trackpoint resource when some error
> happens.

Is there any advantage of doing so beside trying to remove one goto?
Because if not, that's the kernel failure style and this is much better
given that if somebody needs to add other commands after initializing the
trackstick, and if those command fail, we can then remove the
trackstick.

Cheers,
Benjamin

> 
> Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@xxxxxxxxx>
> ---
>  drivers/input/mouse/elantech.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
> index be5b399..8c53a17 100644
> --- a/drivers/input/mouse/elantech.c
> +++ b/drivers/input/mouse/elantech.c
> @@ -1725,8 +1725,10 @@ int elantech_init(struct psmouse *psmouse)
>  		__set_bit(INPUT_PROP_POINTING_STICK, tp_dev->propbit);
>  
>  		error = input_register_device(etd->tp_dev);
> -		if (error < 0)
> -			goto init_fail_tp_reg;
> +		if (error < 0) {
> +			input_free_device(tp_dev);
> +			goto init_fail_tp_alloc;
> +		}
>  	}
>  
>  	psmouse->protocol_handler = elantech_process_byte;
> @@ -1735,8 +1737,6 @@ int elantech_init(struct psmouse *psmouse)
>  	psmouse->pktsize = etd->hw_version > 1 ? 6 : 4;
>  
>  	return 0;
> - init_fail_tp_reg:
> -	input_free_device(tp_dev);
>   init_fail_tp_alloc:
>  	sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj,
>  			   &elantech_attr_group);
> -- 
> 2.7.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux