All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: rafael@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] base: dd: fix error return code of driver_sysfs_add()
Date: Tue, 23 Mar 2021 14:57:11 +0100	[thread overview]
Message-ID: <YFnztyaTn47fjlnr@kroah.com> (raw)
In-Reply-To: <20210305102405.14940-1-baijiaju1990@gmail.com>

On Fri, Mar 05, 2021 at 02:24:05AM -0800, Jia-Ju Bai wrote:
> When device_create_file() fails and returns a non-zero value, 
> no error return code of driver_sysfs_add() is assigned.
> To fix this bug, ret is assigned with the return value of
> device_create_file(), and then ret is checked.
> 
> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> ---
>  drivers/base/dd.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> index 9179825ff646..f94bbef95258 100644
> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -413,8 +413,11 @@ static int driver_sysfs_add(struct device *dev)
>  	if (ret)
>  		goto rm_dev;
>  
> -	if (!IS_ENABLED(CONFIG_DEV_COREDUMP) || !dev->driver->coredump ||
> -	    !device_create_file(dev, &dev_attr_coredump))
> +	if (!IS_ENABLED(CONFIG_DEV_COREDUMP) || !dev->driver->coredump)
> +		return 0;
> +	

Trailing whitespace :(


  parent reply	other threads:[~2021-03-23 13:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05 10:24 [PATCH] base: dd: fix error return code of driver_sysfs_add() Jia-Ju Bai
2021-03-05 17:30 ` Rafael J. Wysocki
2021-03-23 13:57 ` Greg KH [this message]
2021-03-24  2:33   ` Jia-Ju Bai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YFnztyaTn47fjlnr@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=baijiaju1990@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.