lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210706184323.fudcbsiu4i34dojs@pengutronix.de>
Date:   Tue, 6 Jul 2021 20:43:23 +0200
From:   Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
To:     Bjorn Andersson <bjorn.andersson@...aro.org>
Cc:     nvdimm@...ts.linux.dev, linux-hyperv@...r.kernel.org,
        kvm@...r.kernel.org, linux-wireless@...r.kernel.org,
        linux-fpga@...r.kernel.org, linux-pci@...r.kernel.org,
        alsa-devel@...a-project.org, linux-cxl@...r.kernel.org,
        platform-driver-x86@...r.kernel.org, target-devel@...r.kernel.org,
        linux-i2c@...r.kernel.org, linux-i3c@...ts.infradead.org,
        linux1394-devel@...ts.sourceforge.net, linux-scsi@...r.kernel.org,
        linux-staging@...ts.linux.dev, linux-acpi@...r.kernel.org,
        industrypack-devel@...ts.sourceforge.net,
        linux-input@...r.kernel.org, xen-devel@...ts.xenproject.org,
        linux-sunxi@...ts.linux.dev, linux-media@...r.kernel.org,
        linux-arm-msm@...r.kernel.org, linux-serial@...r.kernel.org,
        linux-remoteproc@...r.kernel.org, greybus-dev@...ts.linaro.org,
        virtualization@...ts.linux-foundation.org,
        linux-arm-kernel@...ts.infradead.org, linux-parisc@...r.kernel.org,
        netdev@...r.kernel.org, linux-usb@...r.kernel.org,
        linux-mmc@...r.kernel.org, linux-mips@...r.kernel.org,
        linux-spi@...r.kernel.org, kernel@...gutronix.de,
        dmaengine@...r.kernel.org, linux-ntb@...glegroups.com,
        linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH v2 4/4] bus: Make remove callback return void

Hello Bjorn,

On Tue, Jul 06, 2021 at 01:08:18PM -0500, Bjorn Andersson wrote:
> On Tue 06 Jul 10:48 CDT 2021, Uwe Kleine-K?nig wrote:
> > diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
> > index c1404d3dae2c..7f6fac618ab2 100644
> > --- a/drivers/rpmsg/rpmsg_core.c
> > +++ b/drivers/rpmsg/rpmsg_core.c
> > @@ -530,7 +530,7 @@ static int rpmsg_dev_probe(struct device *dev)
> >  	return err;
> >  }
> >  
> > -static int rpmsg_dev_remove(struct device *dev)
> > +static void rpmsg_dev_remove(struct device *dev)
> >  {
> >  	struct rpmsg_device *rpdev = to_rpmsg_device(dev);
> >  	struct rpmsg_driver *rpdrv = to_rpmsg_driver(rpdev->dev.driver);
> > @@ -546,8 +546,6 @@ static int rpmsg_dev_remove(struct device *dev)
> >  
> >  	if (rpdev->ept)
> >  		rpmsg_destroy_ept(rpdev->ept);
> > -
> > -	return err;
> 
> This leaves err assigned but never used, but I don't mind following up
> with a patch cleaning that up after this has landed.

Ah, good catch. If I send out a v3 I will fold the following into this
patch:

diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
index 7f6fac618ab2..9151836190ce 100644
--- a/drivers/rpmsg/rpmsg_core.c
+++ b/drivers/rpmsg/rpmsg_core.c
@@ -534,10 +534,9 @@ static void rpmsg_dev_remove(struct device *dev)
 {
 	struct rpmsg_device *rpdev = to_rpmsg_device(dev);
 	struct rpmsg_driver *rpdrv = to_rpmsg_driver(rpdev->dev.driver);
-	int err = 0;
 
 	if (rpdev->ops->announce_destroy)
-		err = rpdev->ops->announce_destroy(rpdev);
+		rpdev->ops->announce_destroy(rpdev);
 
 	if (rpdrv->remove)
 		rpdrv->remove(rpdev);

Maybe .announce_destroy() should then be changed to return void, too?
Something like:

diff --git a/drivers/rpmsg/rpmsg_internal.h b/drivers/rpmsg/rpmsg_internal.h
index a76c344253bf..d5204756714c 100644
--- a/drivers/rpmsg/rpmsg_internal.h
+++ b/drivers/rpmsg/rpmsg_internal.h
@@ -40,7 +40,7 @@ struct rpmsg_device_ops {
 					    struct rpmsg_channel_info chinfo);
 
 	int (*announce_create)(struct rpmsg_device *ept);
-	int (*announce_destroy)(struct rpmsg_device *ept);
+	void (*announce_destroy)(struct rpmsg_device *ept);
 };
 
 /**
diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
index 8e49a3bacfc7..4e05994634f8 100644
--- a/drivers/rpmsg/virtio_rpmsg_bus.c
+++ b/drivers/rpmsg/virtio_rpmsg_bus.c
@@ -340,7 +340,7 @@ static int virtio_rpmsg_announce_create(struct rpmsg_device *rpdev)
 	return err;
 }
 
-static int virtio_rpmsg_announce_destroy(struct rpmsg_device *rpdev)
+static void virtio_rpmsg_announce_destroy(struct rpmsg_device *rpdev)
 {
 	struct virtio_rpmsg_channel *vch = to_virtio_rpmsg_channel(rpdev);
 	struct virtproc_info *vrp = vch->vrp;
@@ -360,8 +360,6 @@ static int virtio_rpmsg_announce_destroy(struct rpmsg_device *rpdev)
 		if (err)
 			dev_err(dev, "failed to announce service %d\n", err);
 	}
-
-	return err;
 }
 
 static const struct rpmsg_device_ops virtio_rpmsg_ops = {

though it's not obvious for me that the last hunk is sensible. (OTOH the
return code is ignored anyhow as rpmsg_dev_remove() is the only caller.

Best regards and thanks
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ