From patchwork Tue Sep 29 13:57:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yaowei Bai X-Patchwork-Id: 7286401 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6DA16BEEA4 for ; Tue, 29 Sep 2015 14:05:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 92B6A2046F for ; Tue, 29 Sep 2015 14:05:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B30FC206E5 for ; Tue, 29 Sep 2015 14:05:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965065AbbI2OFk (ORCPT ); Tue, 29 Sep 2015 10:05:40 -0400 Received: from m12-15.163.com ([220.181.12.15]:52326 "EHLO m12-15.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964921AbbI2OFj (ORCPT ); Tue, 29 Sep 2015 10:05:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=ma6MOccpT3M+gYPitr W8qKjCFE0soBbVNMUehnlXkUs=; b=QwTPnGeAlP4UKe3HEB+iLojdHhAFO8JeIL HBbF2E4UMufh4AVVdIZlklxatdPvcD6qSqrF7tz4uYnA9sVjSn3G+U585buu35Jt O7DFVag6m+pR+QOP/HRQ18yiLaIDlxAyQVtrSF5OfeukTLxyN4QWfqxyNpUX4o3C UjdsJUP5Y= Received: from localhost.localdomain (unknown [58.209.166.66]) by smtp11 (Coremail) with SMTP id D8CowECpGllFmQpWim2BBg--.57777S3; Tue, 29 Sep 2015 21:59:35 +0800 (CST) From: Yaowei Bai To: viro@zeniv.linux.org.uk, dedekind1@gmail.com, adrian.hunter@intel.com Cc: linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] fs/ubifs: remove unnecessary new_valid_dev check Date: Tue, 29 Sep 2015 21:57:33 +0800 Message-Id: <1443535053-4673-1-git-send-email-bywxiaobai@163.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1443446807-4838-1-git-send-email-bywxiaobai@163.com> References: <1443446807-4838-1-git-send-email-bywxiaobai@163.com> X-CM-TRANSID: D8CowECpGllFmQpWim2BBg--.57777S3 X-Coremail-Antispam: 1Uf129KBjvJXoW7ur1DZw45uFW5XFyDXrykGrg_yoW8JFW3pF WrKa4rJryrGayDCFs0vr1rGa1UGFnaga45uwsI93WSq39xAa17tr1rtFyFqryFyFWvyF48 Zr4jka1UWr45XaUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jg6pPUUUUU= X-Originating-IP: [58.209.166.66] X-CM-SenderInfo: xe1z5x5dretxi6rwjhhfrp/1tbiKwiET1QG9XzI3AAAsn Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD, 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 As currently new_valid_dev always returns 1, so new_valid_dev check is not needed, remove it. Signed-off-by: Yaowei Bai Reviewed-by: Richard Weinberger Signed-off-by: Artem Bityutskiy --- fs/ubifs/dir.c | 3 --- fs/ubifs/misc.h | 9 ++------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 5c27c66..1dd9267 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c @@ -787,9 +787,6 @@ static int ubifs_mknod(struct inode *dir, struct dentry *dentry, dbg_gen("dent '%pd' in dir ino %lu", dentry, dir->i_ino); - if (!new_valid_dev(rdev)) - return -EINVAL; - if (S_ISBLK(mode) || S_ISCHR(mode)) { dev = kmalloc(sizeof(union ubifs_dev_desc), GFP_NOFS); if (!dev) diff --git a/fs/ubifs/misc.h b/fs/ubifs/misc.h index ee7cb5e..8ece6ca 100644 --- a/fs/ubifs/misc.h +++ b/fs/ubifs/misc.h @@ -155,13 +155,8 @@ static inline int ubifs_wbuf_sync(struct ubifs_wbuf *wbuf) */ static inline int ubifs_encode_dev(union ubifs_dev_desc *dev, dev_t rdev) { - if (new_valid_dev(rdev)) { - dev->new = cpu_to_le32(new_encode_dev(rdev)); - return sizeof(dev->new); - } else { - dev->huge = cpu_to_le64(huge_encode_dev(rdev)); - return sizeof(dev->huge); - } + dev->new = cpu_to_le32(new_encode_dev(rdev)); + return sizeof(dev->new); } /**