From patchwork Tue Sep 25 05:43:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 1501901 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 2F4ABDF28C for ; Tue, 25 Sep 2012 05:43:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752902Ab2IYFnd (ORCPT ); Tue, 25 Sep 2012 01:43:33 -0400 Received: from mail-qa0-f53.google.com ([209.85.216.53]:53495 "EHLO mail-qa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752864Ab2IYFnc (ORCPT ); Tue, 25 Sep 2012 01:43:32 -0400 Received: by qaat11 with SMTP id t11so1499091qaa.19 for ; Mon, 24 Sep 2012 22:43:32 -0700 (PDT) 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=Ryr8aSeI/+i2EayFLhwAboYdHVQ+uIGLJlM14AsfvQk=; b=oMBvFCcvVAKqizB8HoFxCAMwiOfhqSvZfq0hkM1QJH5lJLofSeEmdGJW3sHy8g1oF0 7VFuBKdApUWSrFHWyFqAff/QE7od8Vs5SOIK/z4hpuzMAh71KwazjiBHtnPuPlNITGTq YodNOZCrhxXhNjLEDa/VeHmeq8CouzS3X4G+yVQR6Z4/wywL0n9OAUf+5i/V3oe7vJ0Z X3bVoWXlDwpp6uindcdM1soeDcm/QZZ0/pxvSm6biG4YrN6tIKFICniJL+NA52vLgcRi WqLCV/eEj2kpsJD+bxMjagF9zlYxyoyenGpJzyhv4anjiuR5cmMm0NHvlcuEjnQL17z8 T68A== MIME-Version: 1.0 Received: by 10.224.178.4 with SMTP id bk4mr37513180qab.38.1348551812081; Mon, 24 Sep 2012 22:43:32 -0700 (PDT) Received: by 10.229.146.194 with HTTP; Mon, 24 Sep 2012 22:43:32 -0700 (PDT) Date: Tue, 25 Sep 2012 13:43:32 +0800 Message-ID: Subject: [PATCH] NFS: fix the return value of nfs4_blkdev_get() From: Wei Yongjun To: Trond.Myklebust@netapp.com Cc: yongjun_wei@trendmicro.com.cn, linux-nfs@vger.kernel.org Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Wei Yongjun In case of error, the function nfs4_blkdev_get() return NULL pointer. But the user nfs4_blk_decode_device() check the return value by using IS_ERR() and get error code from the return value. So we should better change the return value of nfs4_blkdev_get() to return ERR_PTR(). dpatch engine is used to auto generate this patch. (https://github.com/weiyj/dpatch) Signed-off-by: Wei Yongjun --- fs/nfs/blocklayout/blocklayoutdev.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" 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/fs/nfs/blocklayout/blocklayoutdev.c b/fs/nfs/blocklayout/blocklayoutdev.c index c965542..8c51518 100644 --- a/fs/nfs/blocklayout/blocklayoutdev.c +++ b/fs/nfs/blocklayout/blocklayoutdev.c @@ -61,12 +61,9 @@ struct block_device *nfs4_blkdev_get(dev_t dev) dprintk("%s enter\n", __func__); bd = blkdev_get_by_dev(dev, FMODE_READ, NULL); if (IS_ERR(bd)) - goto fail; + dprintk("%s failed to open device : %ld\n", + __func__, PTR_ERR(bd)); return bd; -fail: - dprintk("%s failed to open device : %ld\n", - __func__, PTR_ERR(bd)); - return NULL; } /*