mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yang Yingliang <yangyingliang@huawei.com>
To: <linux-kernel@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>
Cc: <viro@zeniv.linux.org.uk>, <logang@deltatee.com>,
	<dan.j.williams@intel.com>, <hans.verkuil@cisco.com>,
	<alexandre.belloni@free-electrons.com>,
	Greg KH <gregkh@linuxfoundation.org>
Subject: Re: [PATCH] chardev: fix error handling in cdev_device_add()
Date: Thu, 23 Dec 2021 09:41:03 +0800	[thread overview]
Message-ID: <1959fa74-b06c-b8bc-d14f-b71e5c4290ee@huawei.com> (raw)
In-Reply-To: <20211012130915.3426584-1-yangyingliang@huawei.com>

ping...

On 2021/10/12 21:09, Yang Yingliang wrote:
> If dev->devt is not set, cdev_device_add() will not add the cdev,
> when device_add failed, cdev_del() is not needed, so delete cdev
> only when dev->devt is set.
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Fixes: 233ed09d7fda ("chardev: add helper function to register...")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>   fs/char_dev.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/char_dev.c b/fs/char_dev.c
> index ba0ded7842a7..3f667292608c 100644
> --- a/fs/char_dev.c
> +++ b/fs/char_dev.c
> @@ -547,7 +547,7 @@ int cdev_device_add(struct cdev *cdev, struct device *dev)
>   	}
>   
>   	rc = device_add(dev);
> -	if (rc)
> +	if (rc && dev->devt)
>   		cdev_del(cdev);
>   
>   	return rc;

  reply	other threads:[~2021-12-23  1:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12 13:09 Yang Yingliang
2021-12-23  1:41 ` Yang Yingliang [this message]
2021-12-23  7:15   ` Greg KH
2021-12-23  7:43     ` Yang Yingliang

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=1959fa74-b06c-b8bc-d14f-b71e5c4290ee@huawei.com \
    --to=yangyingliang@huawei.com \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=dan.j.williams@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hans.verkuil@cisco.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=logang@deltatee.com \
    --cc=viro@zeniv.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®