[PATCH 10/12] imx_keypad: Fix error handling

Sascha Hauer s.hauer at pengutronix.de
Wed Apr 23 02:54:24 PDT 2014


On Sat, Apr 12, 2014 at 12:11:03PM +0400, Alexander Shiyan wrote:
> Signed-off-by: Alexander Shiyan <shc_work at mail.ru>
> ---
>  drivers/input/imx_keypad.c | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/input/imx_keypad.c b/drivers/input/imx_keypad.c
> index e6870df..a1e2055 100644
> --- a/drivers/input/imx_keypad.c
> +++ b/drivers/input/imx_keypad.c
> @@ -392,17 +392,17 @@ static int __init imx_keypad_probe(struct device_d *dev)
>  	struct console_device *cdev;
>  	int error, i;
>  
> -	keypad = xzalloc(sizeof(struct imx_keypad));
> -	if (!keypad) {
> -		pr_err("not enough memory for driver data\n");
> -		error = -ENOMEM;
> -	}
> -
>  	if (!keymap_data) {
>  		pr_err("no keymap defined\n");
>  		return -ENODEV;
>  	}
>  
> +	keypad = xzalloc(sizeof(struct imx_keypad));
> +	if (!keypad) {
> +		pr_err("not enough memory for driver data\n");
> +		return -ENOMEM;
> +	}

No need to check the result from xzalloc. Removed this while applying.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list