diff options
Diffstat (limited to 'target/linux/bcm27xx/patches-5.4/950-0384-driver-char-rpivid-Clean-up-error-handling-use-of-ER.patch')
-rw-r--r-- | target/linux/bcm27xx/patches-5.4/950-0384-driver-char-rpivid-Clean-up-error-handling-use-of-ER.patch | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/target/linux/bcm27xx/patches-5.4/950-0384-driver-char-rpivid-Clean-up-error-handling-use-of-ER.patch b/target/linux/bcm27xx/patches-5.4/950-0384-driver-char-rpivid-Clean-up-error-handling-use-of-ER.patch new file mode 100644 index 0000000000..b61e2c5cfe --- /dev/null +++ b/target/linux/bcm27xx/patches-5.4/950-0384-driver-char-rpivid-Clean-up-error-handling-use-of-ER.patch @@ -0,0 +1,62 @@ +From 8b95d0d18fcfb940fb0d171663ce5c93b8fb0024 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson <dave.stevenson@raspberrypi.com> +Date: Tue, 21 Jan 2020 16:24:45 +0000 +Subject: [PATCH] driver: char: rpivid: Clean up error handling use of + ERR_PTR/IS_ERR + +The driver used an unnecessary intermediate void* variable so it +only called ERR_PTR once to convert to the error value. + +Switch to converting as the error arises to remove these intermediate +variables. + +Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> +--- + drivers/char/broadcom/rpivid-mem.c | 17 +++++++---------- + 1 file changed, 7 insertions(+), 10 deletions(-) + +--- a/drivers/char/broadcom/rpivid-mem.c ++++ b/drivers/char/broadcom/rpivid-mem.c +@@ -130,10 +130,8 @@ static const struct of_device_id rpivid_ + static int rpivid_mem_probe(struct platform_device *pdev) + { + int err; +- void *ptr_err; + const struct of_device_id *id; + struct device *dev = &pdev->dev; +- struct device *rpivid_mem_dev; + struct resource *ioresource; + struct rpivid_mem_priv *priv; + +@@ -183,16 +181,16 @@ static int rpivid_mem_probe(struct platf + /* Create sysfs entries */ + + priv->class = class_create(THIS_MODULE, priv->name); +- ptr_err = priv->class; +- if (IS_ERR(ptr_err)) ++ if (IS_ERR(priv->class)) { ++ err = PTR_ERR(priv->class); + goto failed_class_create; ++ } + +- rpivid_mem_dev = device_create(priv->class, NULL, +- priv->devid, NULL, +- priv->name); +- ptr_err = rpivid_mem_dev; +- if (IS_ERR(ptr_err)) ++ dev = device_create(priv->class, NULL, priv->devid, NULL, priv->name); ++ if (IS_ERR(dev)) { ++ err = PTR_ERR(dev); + goto failed_device_create; ++ } + + /* Legacy alias */ + { +@@ -217,7 +215,6 @@ failed_device_create: + class_destroy(priv->class); + failed_class_create: + cdev_del(&priv->rpivid_mem_cdev); +- err = PTR_ERR(ptr_err); + failed_cdev_add: + unregister_chrdev_region(priv->devid, 1); + failed_alloc_chrdev: |