From: Dan Carpenter Date: Thu, 13 Nov 2014 06:20:59 +0000 (+0300) Subject: usb: gadget: f_hid: fix error handling in ghid_setup() X-Git-Tag: omap-for-v3.19/fixes-rc1~87^2~32^2~35 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0448d38c1e8cd64fb2fa88f44cbc7c3dcf75ed6c;p=pandora-kernel.git usb: gadget: f_hid: fix error handling in ghid_setup() There were a two issues here. 1) We returned PTR_ERR(NULL) which means success if class_create() failed. 2) If alloc_chrdev_region() failed then we should clean up before returning. Also kernel style is to have "error handling" as opposed to "success handling". In the original code checking for "if (!status) " is confusing and this bad style is what lead to bug #2. Signed-off-by: Dan Carpenter Signed-off-by: Felipe Balbi --- Reading git-diff-tree failed