1 From 8b95d0d18fcfb940fb0d171663ce5c93b8fb0024 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Tue, 21 Jan 2020 16:24:45 +0000
4 Subject: [PATCH] driver: char: rpivid: Clean up error handling use of
7 The driver used an unnecessary intermediate void* variable so it
8 only called ERR_PTR once to convert to the error value.
10 Switch to converting as the error arises to remove these intermediate
13 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
15 drivers/char/broadcom/rpivid-mem.c | 17 +++++++----------
16 1 file changed, 7 insertions(+), 10 deletions(-)
18 --- a/drivers/char/broadcom/rpivid-mem.c
19 +++ b/drivers/char/broadcom/rpivid-mem.c
20 @@ -130,10 +130,8 @@ static const struct of_device_id rpivid_
21 static int rpivid_mem_probe(struct platform_device *pdev)
25 const struct of_device_id *id;
26 struct device *dev = &pdev->dev;
27 - struct device *rpivid_mem_dev;
28 struct resource *ioresource;
29 struct rpivid_mem_priv *priv;
31 @@ -183,16 +181,16 @@ static int rpivid_mem_probe(struct platf
32 /* Create sysfs entries */
34 priv->class = class_create(THIS_MODULE, priv->name);
35 - ptr_err = priv->class;
36 - if (IS_ERR(ptr_err))
37 + if (IS_ERR(priv->class)) {
38 + err = PTR_ERR(priv->class);
39 goto failed_class_create;
42 - rpivid_mem_dev = device_create(priv->class, NULL,
45 - ptr_err = rpivid_mem_dev;
46 - if (IS_ERR(ptr_err))
47 + dev = device_create(priv->class, NULL, priv->devid, NULL, priv->name);
50 goto failed_device_create;
55 @@ -217,7 +215,6 @@ failed_device_create:
56 class_destroy(priv->class);
58 cdev_del(&priv->rpivid_mem_cdev);
59 - err = PTR_ERR(ptr_err);
61 unregister_chrdev_region(priv->devid, 1);