Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4763153ybi; Tue, 11 Jun 2019 12:06:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxaSmDXwOsN7RDfrfFTnDUHtOOBvzpk2Nz3yJ0NFvxBfWaZ2BcywUzB6LbNColjfREBgZPn X-Received: by 2002:a17:90a:9d81:: with SMTP id k1mr28253857pjp.63.1560279974151; Tue, 11 Jun 2019 12:06:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560279974; cv=none; d=google.com; s=arc-20160816; b=SOakOuv3rFL5TZNB1mUwvi9NfSvxrdAAOJepF4VTNN8XxYFf+fj89AJnaS3SwArBQY rO/rGf9Rt5Ebb7gJwq8HxYg5rl8keZrhOwqN20sycRonb5stLIByGY1mNBSqwr4hHffO lGTjRdWv9p3PqFbaybw7Cp1kQgofb4Hy+PvNOijmbtNYoyRh+nOHqsGDc5kQGKK0jNzR Jims4Sss3XME2nIpgOkNcfGB47s68N8aV7ov9a5c7EIOieXUPOeKO8LJxJAFHumH/AMe WQasguzBQIeN1FBFM1NiM9o8JkUCLmjfy9DipBvVEU8u0QSaO1rTgVQH45CUsIveeJ4T m62A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=LfB1+GeKbAUZyCeJUvOHN8vzTE/77MDHltrkD0tyB7w=; b=G/PR46O+cPiar6vwGfQ1i4U8eZxReviKE636n7b17sg5jW0jon2eF5vJn65PuLgyiC 49/PYHc7U4Ij01k3yV4EgVedTfMhTPu5v3dnNZDYfnjb/+QQVAKRTHa5lRt7cSbqzryD /EfnDD9F+0jRQUqs8Blh7NDLioXYNfIj0fAHaQ+E7jhv6jdHD8kK4vVD9+uPV4q1HV1R lOGncKtEJU4RXgmcaJikoAwEi+DN1MUp1T7ZHnGBGAIZEjtXn5pR7cw5Pd1+2dXwntW3 AfWZkjGV31i9ygdRB6RIyMU8EUUmW94y4i6zwlFe/v8VviCd99p+yd2PWijrRHwZk+sr a+Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ly5kCkPT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x21si3123335pjt.37.2019.06.11.12.05.55; Tue, 11 Jun 2019 12:06:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ly5kCkPT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391832AbfFKSiV (ORCPT + 99 others); Tue, 11 Jun 2019 14:38:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:58584 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388207AbfFKSiV (ORCPT ); Tue, 11 Jun 2019 14:38:21 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 226E521743; Tue, 11 Jun 2019 18:38:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560278299; bh=op+unP1g+6aUGXSass0EO2pdGGP4Nq3gma2bxnFko7M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ly5kCkPTmC6TeT8l+bNynWgf3TWDMqnvP1eknwgLW7uAtDbNAowHDFBLz0B9qNPOQ RFJb9anzu0k96SWyB9vx9S7QTWECzL5y+z61xdxYuf09TJgr0QyDAN8Cff8EIyp+lQ dx7r2cIFusvTLn2NinOArGRBnwwlUfIQmY4AsKKk= Date: Tue, 11 Jun 2019 20:38:16 +0200 From: Greg Kroah-Hartman To: Tomas Winkler Cc: Arnd Bergmann , linux-kernel@vger.kernel.org Subject: [PATCH v2] mei: no need to check return value of debugfs_create functions Message-ID: <20190611183816.GA952@kroah.com> References: <20190611183357.GA32008@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190611183357.GA32008@kroah.com> User-Agent: Mutt/1.12.0 (2019-05-25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Tomas Winkler Cc: Arnd Bergmann Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- v2: break the patch up properly drivers/misc/mei/debugfs.c | 47 +++++++++----------------------------- drivers/misc/mei/main.c | 8 +------ drivers/misc/mei/mei_dev.h | 7 ++---- 3 files changed, 14 insertions(+), 48 deletions(-) diff --git a/drivers/misc/mei/debugfs.c b/drivers/misc/mei/debugfs.c index 0970142bcace..df6bf8b81936 100644 --- a/drivers/misc/mei/debugfs.c +++ b/drivers/misc/mei/debugfs.c @@ -233,47 +233,22 @@ void mei_dbgfs_deregister(struct mei_device *dev) * * @dev: the mei device structure * @name: the mei device name - * - * Return: 0 on success, <0 on failure. */ -int mei_dbgfs_register(struct mei_device *dev, const char *name) +void mei_dbgfs_register(struct mei_device *dev, const char *name) { - struct dentry *dir, *f; + struct dentry *dir; dir = debugfs_create_dir(name, NULL); - if (!dir) - return -ENOMEM; - dev->dbgfs_dir = dir; - f = debugfs_create_file("meclients", S_IRUSR, dir, - dev, &mei_dbgfs_fops_meclients); - if (!f) { - dev_err(dev->dev, "meclients: registration failed\n"); - goto err; - } - f = debugfs_create_file("active", S_IRUSR, dir, - dev, &mei_dbgfs_fops_active); - if (!f) { - dev_err(dev->dev, "active: registration failed\n"); - goto err; - } - f = debugfs_create_file("devstate", S_IRUSR, dir, - dev, &mei_dbgfs_fops_devstate); - if (!f) { - dev_err(dev->dev, "devstate: registration failed\n"); - goto err; - } - f = debugfs_create_file("allow_fixed_address", S_IRUSR | S_IWUSR, dir, - &dev->allow_fixed_address, - &mei_dbgfs_fops_allow_fa); - if (!f) { - dev_err(dev->dev, "allow_fixed_address: registration failed\n"); - goto err; - } - return 0; -err: - mei_dbgfs_deregister(dev); - return -ENODEV; + debugfs_create_file("meclients", S_IRUSR, dir, dev, + &mei_dbgfs_fops_meclients); + debugfs_create_file("active", S_IRUSR, dir, dev, + &mei_dbgfs_fops_active); + debugfs_create_file("devstate", S_IRUSR, dir, dev, + &mei_dbgfs_fops_devstate); + debugfs_create_file("allow_fixed_address", S_IRUSR | S_IWUSR, dir, + &dev->allow_fixed_address, + &mei_dbgfs_fops_allow_fa); } diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index ad02097d7fee..f894d1f8a53e 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c @@ -984,16 +984,10 @@ int mei_register(struct mei_device *dev, struct device *parent) goto err_dev_create; } - ret = mei_dbgfs_register(dev, dev_name(clsdev)); - if (ret) { - dev_err(clsdev, "cannot register debugfs ret = %d\n", ret); - goto err_dev_dbgfs; - } + mei_dbgfs_register(dev, dev_name(clsdev)); return 0; -err_dev_dbgfs: - device_destroy(mei_class, devno); err_dev_create: cdev_del(&dev->cdev); err_dev_add: diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h index fca832fcac57..f71a023aed3c 100644 --- a/drivers/misc/mei/mei_dev.h +++ b/drivers/misc/mei/mei_dev.h @@ -718,13 +718,10 @@ bool mei_hbuf_acquire(struct mei_device *dev); bool mei_write_is_idle(struct mei_device *dev); #if IS_ENABLED(CONFIG_DEBUG_FS) -int mei_dbgfs_register(struct mei_device *dev, const char *name); +void mei_dbgfs_register(struct mei_device *dev, const char *name); void mei_dbgfs_deregister(struct mei_device *dev); #else -static inline int mei_dbgfs_register(struct mei_device *dev, const char *name) -{ - return 0; -} +static inline void mei_dbgfs_register(struct mei_device *dev, const char *name) {} static inline void mei_dbgfs_deregister(struct mei_device *dev) {} #endif /* CONFIG_DEBUG_FS */ -- 2.22.0