]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
xen: make remove callback of xen driver void returned
authorDawei Li <set_pte_at@outlook.com>
Mon, 26 Jan 2026 15:51:18 +0000 (10:51 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Feb 2026 15:44:18 +0000 (16:44 +0100)
[ Upstream commit 7cffcade57a429667447c4f41d8414bbcf1b3aaa ]

Since commit fc7a6209d571 ("bus: Make remove callback return void")
forces bus_type::remove be void-returned, it doesn't make much sense for
any bus based driver implementing remove callbalk to return non-void to
its caller.

This change is for xen bus based drivers.

Acked-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Dawei Li <set_pte_at@outlook.com>
Link: https://lore.kernel.org/r/TYCP286MB23238119AB4DF190997075C9CAE39@TYCP286MB2323.JPNP286.PROD.OUTLOOK.COM
Signed-off-by: Juergen Gross <jgross@suse.com>
Stable-dep-of: 901a5f309dab ("scsi: xen: scsiback: Fix potential memory leak in scsiback_remove()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19 files changed:
drivers/block/xen-blkback/xenbus.c
drivers/block/xen-blkfront.c
drivers/char/tpm/xen-tpmfront.c
drivers/gpu/drm/xen/xen_drm_front.c
drivers/input/misc/xen-kbdfront.c
drivers/net/xen-netback/xenbus.c
drivers/net/xen-netfront.c
drivers/pci/xen-pcifront.c
drivers/scsi/xen-scsifront.c
drivers/tty/hvc/hvc_xen.c
drivers/usb/host/xen-hcd.c
drivers/video/fbdev/xen-fbfront.c
drivers/xen/pvcalls-back.c
drivers/xen/pvcalls-front.c
drivers/xen/xen-pciback/xenbus.c
drivers/xen/xen-scsiback.c
include/xen/xenbus.h
net/9p/trans_xen.c
sound/xen/xen_snd_front.c

index c0227dfa468879cb3af300caba282b620f3ac824..4807af1d58059394d7a992335dabaf2bc3901721 100644 (file)
@@ -524,7 +524,7 @@ static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle,
        return 0;
 }
 
-static int xen_blkbk_remove(struct xenbus_device *dev)
+static void xen_blkbk_remove(struct xenbus_device *dev)
 {
        struct backend_info *be = dev_get_drvdata(&dev->dev);
 
@@ -547,8 +547,6 @@ static int xen_blkbk_remove(struct xenbus_device *dev)
                /* Put the reference we set in xen_blkif_alloc(). */
                xen_blkif_put(be->blkif);
        }
-
-       return 0;
 }
 
 int xen_blkbk_flush_diskcache(struct xenbus_transaction xbt,
index 5ddf393aa390f0ca14e13ef0e44d4a111c75d60b..8f91c48cbd37feb248cb2210fc80955bd06c9976 100644 (file)
@@ -2469,7 +2469,7 @@ static void blkback_changed(struct xenbus_device *dev,
        }
 }
 
-static int blkfront_remove(struct xenbus_device *xbdev)
+static void blkfront_remove(struct xenbus_device *xbdev)
 {
        struct blkfront_info *info = dev_get_drvdata(&xbdev->dev);
 
@@ -2490,7 +2490,6 @@ static int blkfront_remove(struct xenbus_device *xbdev)
        }
 
        kfree(info);
-       return 0;
 }
 
 static int blkfront_is_ready(struct xenbus_device *dev)
index 3792918262617983cd21d424a736955c395400b8..80cca3b83b226aa10918fc6e7a7468a43bd91996 100644 (file)
@@ -360,14 +360,13 @@ static int tpmfront_probe(struct xenbus_device *dev,
        return tpm_chip_register(priv->chip);
 }
 
-static int tpmfront_remove(struct xenbus_device *dev)
+static void tpmfront_remove(struct xenbus_device *dev)
 {
        struct tpm_chip *chip = dev_get_drvdata(&dev->dev);
        struct tpm_private *priv = dev_get_drvdata(&chip->dev);
        tpm_chip_unregister(chip);
        ring_free(priv);
        dev_set_drvdata(&chip->dev, NULL);
-       return 0;
 }
 
 static int tpmfront_resume(struct xenbus_device *dev)
index 0d8e6bd1ccbf207d0dd2e276ae7d19adf704d006..90996c108146dbf2e12bb945af1099bc710c288b 100644 (file)
@@ -717,7 +717,7 @@ static int xen_drv_probe(struct xenbus_device *xb_dev,
        return xenbus_switch_state(xb_dev, XenbusStateInitialising);
 }
 
-static int xen_drv_remove(struct xenbus_device *dev)
+static void xen_drv_remove(struct xenbus_device *dev)
 {
        struct xen_drm_front_info *front_info = dev_get_drvdata(&dev->dev);
        int to = 100;
@@ -751,7 +751,6 @@ static int xen_drv_remove(struct xenbus_device *dev)
 
        xen_drm_drv_fini(front_info);
        xenbus_frontend_closed(dev);
-       return 0;
 }
 
 static const struct xenbus_device_id xen_driver_ids[] = {
index 8d8ebdc2039b8eb68338c725ff77c34fdac77458..67f1c7364c95d3814de41e99c2ec3d6fdc61a79a 100644 (file)
@@ -51,7 +51,7 @@ module_param_array(ptr_size, int, NULL, 0444);
 MODULE_PARM_DESC(ptr_size,
        "Pointing device width, height in pixels (default 800,600)");
 
-static int xenkbd_remove(struct xenbus_device *);
+static void xenkbd_remove(struct xenbus_device *);
 static int xenkbd_connect_backend(struct xenbus_device *, struct xenkbd_info *);
 static void xenkbd_disconnect_backend(struct xenkbd_info *);
 
@@ -404,7 +404,7 @@ static int xenkbd_resume(struct xenbus_device *dev)
        return xenkbd_connect_backend(dev, info);
 }
 
-static int xenkbd_remove(struct xenbus_device *dev)
+static void xenkbd_remove(struct xenbus_device *dev)
 {
        struct xenkbd_info *info = dev_get_drvdata(&dev->dev);
 
@@ -417,7 +417,6 @@ static int xenkbd_remove(struct xenbus_device *dev)
                input_unregister_device(info->mtouch);
        free_page((unsigned long)info->page);
        kfree(info);
-       return 0;
 }
 
 static int xenkbd_connect_backend(struct xenbus_device *dev,
index c1ba4294f364793f16397bca14ba6b75f5c8bd59..001636901ddae2e8afededa02d6b9533c7912b79 100644 (file)
@@ -977,7 +977,7 @@ static int read_xenbus_vif_flags(struct backend_info *be)
        return 0;
 }
 
-static int netback_remove(struct xenbus_device *dev)
+static void netback_remove(struct xenbus_device *dev)
 {
        struct backend_info *be = dev_get_drvdata(&dev->dev);
 
@@ -992,7 +992,6 @@ static int netback_remove(struct xenbus_device *dev)
        kfree(be->hotplug_script);
        kfree(be);
        dev_set_drvdata(&dev->dev, NULL);
-       return 0;
 }
 
 /*
index 74925e1664626b70b30cfbd75721e0f5c226c43d..dd40e0d98d7e74363dcbdb0a0ae6c3961781e283 100644 (file)
@@ -2652,7 +2652,7 @@ static void xennet_bus_close(struct xenbus_device *dev)
        } while (!ret);
 }
 
-static int xennet_remove(struct xenbus_device *dev)
+static void xennet_remove(struct xenbus_device *dev)
 {
        struct netfront_info *info = dev_get_drvdata(&dev->dev);
 
@@ -2668,8 +2668,6 @@ static int xennet_remove(struct xenbus_device *dev)
                rtnl_unlock();
        }
        xennet_free_netdev(info->netdev);
-
-       return 0;
 }
 
 static const struct xenbus_device_id netfront_ids[] = {
index 7378e2f3e525fd1290cc482e8329a74d635685b5..fcd029ca2eb184a9e4ee48773c1dd1e906be8fd1 100644 (file)
@@ -1055,14 +1055,12 @@ out:
        return err;
 }
 
-static int pcifront_xenbus_remove(struct xenbus_device *xdev)
+static void pcifront_xenbus_remove(struct xenbus_device *xdev)
 {
        struct pcifront_device *pdev = dev_get_drvdata(&xdev->dev);
 
        if (pdev)
                free_pdev(pdev);
-
-       return 0;
 }
 
 static const struct xenbus_device_id xenpci_ids[] = {
index 66b316d173b0b4155b26c2d64d5d5213e3c6fdec..71a3bb83984c0097ce440977b9b0d792dd3b3009 100644 (file)
@@ -995,7 +995,7 @@ static int scsifront_suspend(struct xenbus_device *dev)
        return err;
 }
 
-static int scsifront_remove(struct xenbus_device *dev)
+static void scsifront_remove(struct xenbus_device *dev)
 {
        struct vscsifrnt_info *info = dev_get_drvdata(&dev->dev);
 
@@ -1011,8 +1011,6 @@ static int scsifront_remove(struct xenbus_device *dev)
 
        scsifront_free_ring(info);
        scsi_host_put(info->host);
-
-       return 0;
 }
 
 static void scsifront_disconnect(struct vscsifrnt_info *info)
index 281bc83acfaddae70b324ffc2fd5a770411686f8..34c01874f45beb23d8470a83acbd38fa9221df72 100644 (file)
@@ -420,9 +420,9 @@ static int xen_console_remove(struct xencons_info *info)
        return 0;
 }
 
-static int xencons_remove(struct xenbus_device *dev)
+static void xencons_remove(struct xenbus_device *dev)
 {
-       return xen_console_remove(dev_get_drvdata(&dev->dev));
+       xen_console_remove(dev_get_drvdata(&dev->dev));
 }
 
 static int xencons_connect_backend(struct xenbus_device *dev,
index de1b091583183f5c86a90fab95e11eec97bebb4f..46fdab940092e334af942b88f4f08906d038118e 100644 (file)
@@ -1530,15 +1530,13 @@ static void xenhcd_backend_changed(struct xenbus_device *dev,
        }
 }
 
-static int xenhcd_remove(struct xenbus_device *dev)
+static void xenhcd_remove(struct xenbus_device *dev)
 {
        struct xenhcd_info *info = dev_get_drvdata(&dev->dev);
        struct usb_hcd *hcd = xenhcd_info_to_hcd(info);
 
        xenhcd_destroy_rings(info);
        usb_put_hcd(hcd);
-
-       return 0;
 }
 
 static int xenhcd_probe(struct xenbus_device *dev,
index 4d2694d904aab6b065b9f64c5530693a5b11e77d..ae8a50ecdbd3a89ed2a5c6951c23a24909edd653 100644 (file)
@@ -67,7 +67,7 @@ MODULE_PARM_DESC(video,
        "Video memory size in MB, width, height in pixels (default 2,800,600)");
 
 static void xenfb_make_preferred_console(void);
-static int xenfb_remove(struct xenbus_device *);
+static void xenfb_remove(struct xenbus_device *);
 static void xenfb_init_shared_page(struct xenfb_info *, struct fb_info *);
 static int xenfb_connect_backend(struct xenbus_device *, struct xenfb_info *);
 static void xenfb_disconnect_backend(struct xenfb_info *);
@@ -527,7 +527,7 @@ static int xenfb_resume(struct xenbus_device *dev)
        return xenfb_connect_backend(dev, info);
 }
 
-static int xenfb_remove(struct xenbus_device *dev)
+static void xenfb_remove(struct xenbus_device *dev)
 {
        struct xenfb_info *info = dev_get_drvdata(&dev->dev);
 
@@ -542,8 +542,6 @@ static int xenfb_remove(struct xenbus_device *dev)
        vfree(info->gfns);
        vfree(info->fb);
        kfree(info);
-
-       return 0;
 }
 
 static unsigned long vmalloc_to_gfn(void *address)
index 0bff02ac0045c94ae22a0645ef246a181d1ac811..c633ebcf11630fd51bad6bffa1711c2eac9dd9d7 100644 (file)
@@ -1180,9 +1180,8 @@ static void pvcalls_back_changed(struct xenbus_device *dev,
        }
 }
 
-static int pvcalls_back_remove(struct xenbus_device *dev)
+static void pvcalls_back_remove(struct xenbus_device *dev)
 {
-       return 0;
 }
 
 static int pvcalls_back_uevent(struct xenbus_device *xdev,
index 9b569278788a48113996ad6ff90b9507f804bfe4..d5d589bda243d4c8c45c24e82bde513a5c750ca3 100644 (file)
@@ -1087,7 +1087,7 @@ static const struct xenbus_device_id pvcalls_front_ids[] = {
        { "" }
 };
 
-static int pvcalls_front_remove(struct xenbus_device *dev)
+static void pvcalls_front_remove(struct xenbus_device *dev)
 {
        struct pvcalls_bedata *bedata;
        struct sock_mapping *map = NULL, *n;
@@ -1123,7 +1123,6 @@ static int pvcalls_front_remove(struct xenbus_device *dev)
        kfree(bedata->ring.sring);
        kfree(bedata);
        xenbus_switch_state(dev, XenbusStateClosed);
-       return 0;
 }
 
 static int pvcalls_front_probe(struct xenbus_device *dev,
index d171091eec123dda417e3b2b32c5aa70184826d3..b11e401f1b1ee92f753b86ad8532f6910aef4da0 100644 (file)
@@ -716,14 +716,12 @@ out:
        return err;
 }
 
-static int xen_pcibk_xenbus_remove(struct xenbus_device *dev)
+static void xen_pcibk_xenbus_remove(struct xenbus_device *dev)
 {
        struct xen_pcibk_device *pdev = dev_get_drvdata(&dev->dev);
 
        if (pdev != NULL)
                free_pdev(pdev);
-
-       return 0;
 }
 
 static const struct xenbus_device_id xen_pcibk_ids[] = {
index 6106ed93817d670be7001dec34146a3bdb74f013..954188b0b858a26e1cdf2195cddaecff6e8bbe5f 100644 (file)
@@ -1249,7 +1249,7 @@ static void scsiback_release_translation_entry(struct vscsibk_info *info)
        spin_unlock_irqrestore(&info->v2p_lock, flags);
 }
 
-static int scsiback_remove(struct xenbus_device *dev)
+static void scsiback_remove(struct xenbus_device *dev)
 {
        struct vscsibk_info *info = dev_get_drvdata(&dev->dev);
 
@@ -1261,8 +1261,6 @@ static int scsiback_remove(struct xenbus_device *dev)
        gnttab_page_cache_shrink(&info->free_pages, 0);
 
        dev_set_drvdata(&dev->dev, NULL);
-
-       return 0;
 }
 
 static int scsiback_probe(struct xenbus_device *dev,
index eaa932b99d8ac2d32a0b0bb73a1a6ce9eff12b95..ad4fb4eab753d41925b82c8de01ee6b1d81cd2fa 100644 (file)
@@ -117,7 +117,7 @@ struct xenbus_driver {
                     const struct xenbus_device_id *id);
        void (*otherend_changed)(struct xenbus_device *dev,
                                 enum xenbus_state backend_state);
-       int (*remove)(struct xenbus_device *dev);
+       void (*remove)(struct xenbus_device *dev);
        int (*suspend)(struct xenbus_device *dev);
        int (*resume)(struct xenbus_device *dev);
        int (*uevent)(struct xenbus_device *, struct kobj_uevent_env *);
index 4ad7e7a269ca0e7b044726561f6a7a4986551a1f..36f432ca4cd54aa9509d09f7499aef053d9fd704 100644 (file)
@@ -307,13 +307,12 @@ static void xen_9pfs_front_free(struct xen_9pfs_front_priv *priv)
        kfree(priv);
 }
 
-static int xen_9pfs_front_remove(struct xenbus_device *dev)
+static void xen_9pfs_front_remove(struct xenbus_device *dev)
 {
        struct xen_9pfs_front_priv *priv = dev_get_drvdata(&dev->dev);
 
        dev_set_drvdata(&dev->dev, NULL);
        xen_9pfs_front_free(priv);
-       return 0;
 }
 
 static int xen_9pfs_front_alloc_dataring(struct xenbus_device *dev,
index 4041748c12e515c090b62f9918a0877ccd0d574c..b66e037710d0dfcbb608b45d8d02a9905977eb3a 100644 (file)
@@ -311,7 +311,7 @@ static int xen_drv_probe(struct xenbus_device *xb_dev,
        return xenbus_switch_state(xb_dev, XenbusStateInitialising);
 }
 
-static int xen_drv_remove(struct xenbus_device *dev)
+static void xen_drv_remove(struct xenbus_device *dev)
 {
        struct xen_snd_front_info *front_info = dev_get_drvdata(&dev->dev);
        int to = 100;
@@ -345,7 +345,6 @@ static int xen_drv_remove(struct xenbus_device *dev)
 
        xen_snd_drv_fini(front_info);
        xenbus_frontend_closed(dev);
-       return 0;
 }
 
 static const struct xenbus_device_id xen_drv_ids[] = {