From patchwork Thu Nov 4 05:59:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: axel lin X-Patchwork-Id: 301022 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oA45qhEf024302 for ; Thu, 4 Nov 2010 05:55:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754150Ab0KDFzy (ORCPT ); Thu, 4 Nov 2010 01:55:54 -0400 Received: from mail-yx0-f174.google.com ([209.85.213.174]:47934 "EHLO mail-yx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754187Ab0KDFzx (ORCPT ); Thu, 4 Nov 2010 01:55:53 -0400 Received: by yxk8 with SMTP id 8so1089638yxk.19 for ; Wed, 03 Nov 2010 22:55:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=9EHXW9vLk2/JaeMc8AEbIzjdQYRNZDgG7hPeGeieu0U=; b=GJv8Lg2zgcrONQUYHyid5kszQXd8/aTYkWXqJ4ijY2c0HCVuDyLpdt4V4BbcRDUaq4 rWu3pJM9LsZq0FhzI/lfsZDezcLvyZ/mbEa45u7VHNfVsQGXz5rUTsB7PNi3C1gZOkUl WFmnqOFnOw0iaiUoAahKh47asYBWXyJf7w6fA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; b=FohMC6J2BWReezok+zrepvIngYkZHQYrasQBRjAlNVnMfzyceC2/22Bn+biEwCc1gL 0T3aM7wDZC51GgN7UFZ3m0DwpAycp5conXT/ydEYgH3mLzae9sTW2iI32QmOyK4BeRzq Wjeb/3W/B7GKU+lqPYCySojw7zvNxWpdiMMbA= Received: by 10.90.59.17 with SMTP id h17mr625180aga.133.1288850153202; Wed, 03 Nov 2010 22:55:53 -0700 (PDT) Received: from [192.168.100.50] (60-251-136-127.HINET-IP.hinet.net [60.251.136.127]) by mx.google.com with ESMTPS id g9sm7870377yha.6.2010.11.03.22.55.49 (version=SSLv3 cipher=RC4-MD5); Wed, 03 Nov 2010 22:55:51 -0700 (PDT) Subject: [PATCH] mmc: Return proper error code for ushc_probe() From: Axel Lin To: linux-kernel Cc: David Vrabel , Chris Ball , linux-mmc@vger.kernel.org Date: Thu, 04 Nov 2010 13:59:11 +0800 Message-Id: <1288850351.3429.2.camel@mola> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 04 Nov 2010 05:55:55 +0000 (UTC) diff --git a/drivers/mmc/host/ushc.c b/drivers/mmc/host/ushc.c index b4ead4a..f8f65df 100644 --- a/drivers/mmc/host/ushc.c +++ b/drivers/mmc/host/ushc.c @@ -425,7 +425,7 @@ static int ushc_probe(struct usb_interface *intf, const struct usb_device_id *id struct usb_device *usb_dev = interface_to_usbdev(intf); struct mmc_host *mmc; struct ushc_data *ushc; - int ret = -ENOMEM; + int ret; mmc = mmc_alloc_host(sizeof(struct ushc_data), &intf->dev); if (mmc == NULL) @@ -462,11 +462,15 @@ static int ushc_probe(struct usb_interface *intf, const struct usb_device_id *id mmc->max_blk_count = 511; ushc->int_urb = usb_alloc_urb(0, GFP_KERNEL); - if (ushc->int_urb == NULL) + if (ushc->int_urb == NULL) { + ret = -ENOMEM; goto err; + } ushc->int_data = kzalloc(sizeof(struct ushc_int_data), GFP_KERNEL); - if (ushc->int_data == NULL) + if (ushc->int_data == NULL) { + ret = -ENOMEM; goto err; + } usb_fill_int_urb(ushc->int_urb, ushc->usb_dev, usb_rcvintpipe(usb_dev, intf->cur_altsetting->endpoint[0].desc.bEndpointAddress), @@ -475,11 +479,15 @@ static int ushc_probe(struct usb_interface *intf, const struct usb_device_id *id intf->cur_altsetting->endpoint[0].desc.bInterval); ushc->cbw_urb = usb_alloc_urb(0, GFP_KERNEL); - if (ushc->cbw_urb == NULL) + if (ushc->cbw_urb == NULL) { + ret = -ENOMEM; goto err; + } ushc->cbw = kzalloc(sizeof(struct ushc_cbw), GFP_KERNEL); - if (ushc->cbw == NULL) + if (ushc->cbw == NULL) { + ret = -ENOMEM; goto err; + } ushc->cbw->signature = USHC_CBW_SIGNATURE; usb_fill_bulk_urb(ushc->cbw_urb, ushc->usb_dev, usb_sndbulkpipe(usb_dev, 2), @@ -487,15 +495,21 @@ static int ushc_probe(struct usb_interface *intf, const struct usb_device_id *id cbw_callback, ushc); ushc->data_urb = usb_alloc_urb(0, GFP_KERNEL); - if (ushc->data_urb == NULL) + if (ushc->data_urb == NULL) { + ret = -ENOMEM; goto err; + } ushc->csw_urb = usb_alloc_urb(0, GFP_KERNEL); - if (ushc->csw_urb == NULL) + if (ushc->csw_urb == NULL) { + ret = -ENOMEM; goto err; + } ushc->csw = kzalloc(sizeof(struct ushc_cbw), GFP_KERNEL); - if (ushc->csw == NULL) + if (ushc->csw == NULL) { + ret = -ENOMEM; goto err; + } usb_fill_bulk_urb(ushc->csw_urb, ushc->usb_dev, usb_rcvbulkpipe(usb_dev, 6), ushc->csw, sizeof(struct ushc_csw), csw_callback, ushc);