Bug 200547

Summary: Wrong return error code when devm_kzalloc() fails in drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
Product: Drivers Reporter: Jason Wood (jasonwood2031)
Component: OtherAssignee: drivers_other
Status: NEW ---    
Severity: normal    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: v4.18-rc4 Subsystem:
Regression: No Bisected commit-id:

Description Jason Wood 2018-07-18 09:00:53 UTC
Function atmel_hlcdc_attach_endpoint() defined in drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c returns -ENODEV when function devm_kzalloc() fails. Codes related to this bug are shown as follows.

drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c:
   34  static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, int endpoint)
   35  {
...
   44  		return ret;
   45  
   46: 	encoder = devm_kzalloc(dev->dev, sizeof(*encoder), GFP_KERNEL);
   47  	if (!encoder)
   48  		return -EINVAL;	// should return -ENOMEM

Thanks for attention!
JW, ZG
IMChecker Group, THU