From patchwork Mon Dec 16 05:50:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 3352031 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 56D5D9F32E for ; Mon, 16 Dec 2013 05:50:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 530B120377 for ; Mon, 16 Dec 2013 05:50:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5896820374 for ; Mon, 16 Dec 2013 05:50:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752462Ab3LPFuD (ORCPT ); Mon, 16 Dec 2013 00:50:03 -0500 Received: from mail-bk0-f49.google.com ([209.85.214.49]:58646 "EHLO mail-bk0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752459Ab3LPFuC (ORCPT ); Mon, 16 Dec 2013 00:50:02 -0500 Received: by mail-bk0-f49.google.com with SMTP id my13so2149006bkb.36 for ; Sun, 15 Dec 2013 21:50:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=UMOMhCowwHsOQegLOyQjFYXRJ9rPB1hgKw9JDI6txY8=; b=fS/WoT1os8xwjZw+MqdQQvamJ+Jx8HRRnvXA3aMHwSU6KWEWOnSKys1JL3kbf9c4Gh YiLl/RUNOvfZoTtSgLbLXIjWapGZZnSN7GlApQHP+c+jEagavT2b2Fle6PoOS7uj3Xdm WfsCUxxJpyPpxcVqD7nhuCSbCMbz12H/gpU6tFOmoi7cDngHcjkAxbvBu8y0ZQb3RMhZ PYqPXHe1eSf0oaEDiocz5vQKZ6+IPrlPqULLFiUFOeCLGlNcIJ0u4i6IYduql3ozYPtP aKMP5L5Ruip2ksyeBOjo//mGvGVij7TGSwsJj/RKYiRZ7s9BBjZuqmOQZE9F1hqsRurj 4TcA== MIME-Version: 1.0 X-Received: by 10.205.64.209 with SMTP id xj17mr80345bkb.76.1387173001141; Sun, 15 Dec 2013 21:50:01 -0800 (PST) Received: by 10.204.74.130 with HTTP; Sun, 15 Dec 2013 21:50:01 -0800 (PST) Date: Mon, 16 Dec 2013 13:50:01 +0800 Message-ID: Subject: [PATCH -next] IB/usnic: fix some error return code From: Wei Yongjun To: umalhi@cisco.com, roland@kernel.org, sean.hefty@intel.com, hal.rosenstock@gmail.com Cc: yongjun_wei@trendmicro.com.cn, linux-rdma@vger.kernel.org Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wei Yongjun This patch make usnic_ib_discover_pf() only return ERR_PTR() only and fix to return a negative error code from the error handling case instead of 0. Signed-off-by: Wei Yongjun --- drivers/infiniband/hw/usnic/usnic_ib_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c index 2bbfa09..e07cccc 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_main.c +++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c @@ -406,6 +406,7 @@ static struct usnic_ib_dev *usnic_ib_discover_pf(struct usnic_vnic *vnic) err = usnic_ib_sysfs_register_usdev(us_ibdev); if (err) { usnic_ib_device_remove(us_ibdev); + us_ibdev = ERR_PTR(err); goto out; } @@ -460,7 +461,8 @@ int usnic_ib_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) } pf = usnic_ib_discover_pf(vf->vnic); - if (!pf) { + if (IS_ERR(pf)) { + err = PTR_ERR(pf); usnic_err("Failed to discover pf of vnic %s with err%d\n", pci_name(pdev), err); goto out_clean_vnic; @@ -543,7 +545,8 @@ static int __init usnic_ib_init(void) return err; } - if (pci_register_driver(&usnic_ib_pci_driver)) { + err = pci_register_driver(&usnic_ib_pci_driver); + if (err) { usnic_err("Unable to register with PCI\n"); goto out_umem_fini; }