Re: [patch] Extcon: check for allocation failure

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

 



> Return -ENOMEM if the kmalloc() fails.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

Acked-by: MyungJoo Ham <myungjoo.ham@xxxxxxxxxxx>


> 
> diff --git a/drivers/extcon/extcon_class.c b/drivers/extcon/extcon_class.c
> index 3bc4b8a..fe5a038 100644
> --- a/drivers/extcon/extcon_class.c
> +++ b/drivers/extcon/extcon_class.c
> @@ -621,6 +621,8 @@ int extcon_dev_register(struct extcon_dev *edev, struct device *dev)
>  	}
>  
>  	edev->dev = kzalloc(sizeof(struct device), GFP_KERNEL);
> +	if (!edev->dev)
> +		return -ENOMEM;
>  	edev->dev->parent = dev;
>  	edev->dev->class = extcon_class;
>  	edev->dev->release = extcon_dev_release;
> 
> 
ÿ淸º{.nÇ+돴윯돪†+%듚ÿ깁負¥Šwÿº{.nÇ+돴¤z받쀸Úž+h?â왲^n‡r⊆¦zË곷h솳鈺Ú&{àz요z받쀺+€Ê+zf"·hš닱~넮녬iÿÿï곴ÿ묎çz_溫æj:+v돣þ)山øm



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux