[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YPg9TBLElQqcn3PS@kroah.com>
Date: Wed, 21 Jul 2021 17:29:16 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Adrian Hunter <adrian.hunter@...el.com>
Cc: "Rafael J . Wysocki" <rafael@...nel.org>,
Saravana Kannan <saravanak@...gle.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
"James E . J . Bottomley" <jejb@...ux.ibm.com>,
linux-scsi@...r.kernel.org, Avri Altman <avri.altman@....com>,
Bean Huo <huobean@...il.com>, Can Guo <cang@...eaurora.org>,
Asutosh Das <asutoshd@...eaurora.org>,
Bart Van Assche <bvanassche@....org>,
linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V4 1/2] driver core: Prevent warning when removing a
device link from unregistered consumer
On Fri, Jul 16, 2021 at 02:44:07PM +0300, Adrian Hunter wrote:
> sysfs_remove_link() causes a warning if the parent directory does not
> exist. That can happen if the device link consumer has not been registered.
> So do not attempt sysfs_remove_link() in that case.
>
> Fixes: 287905e68dd29 ("driver core: Expose device link details in sysfs")
> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
> Cc: stable@...r.kernel.org # 5.9+
> Reviewed-by: Rafael J. Wysocki <rafael@...nel.org>
> ---
> drivers/base/core.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index ea5b85354526..2de8f7d8cf54 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -575,8 +575,10 @@ static void devlink_remove_symlinks(struct device *dev,
> return;
> }
>
> - snprintf(buf, len, "supplier:%s:%s", dev_bus_name(sup), dev_name(sup));
> - sysfs_remove_link(&con->kobj, buf);
> + if (device_is_registered(con)) {
> + snprintf(buf, len, "supplier:%s:%s", dev_bus_name(sup), dev_name(sup));
> + sysfs_remove_link(&con->kobj, buf);
> + }
> snprintf(buf, len, "consumer:%s:%s", dev_bus_name(con), dev_name(con));
> sysfs_remove_link(&sup->kobj, buf);
> kfree(buf);
> --
> 2.17.1
>
I've applied this patch to my tree now.
thanks,
greg k-h
Powered by blists - more mailing lists