1 From 7b4ea31990c1c43ad8ea86d42c1e451c85933d87 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Wed, 15 Jan 2020 14:02:43 +0000
4 Subject: [PATCH] driver: char: rpivid: Add error handling to the
7 The return value from device_create for the legacy device was never
8 checked or handled. Add the required error handling.
10 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
12 drivers/char/broadcom/rpivid-mem.c | 11 +++++++++--
13 1 file changed, 9 insertions(+), 2 deletions(-)
15 --- a/drivers/char/broadcom/rpivid-mem.c
16 +++ b/drivers/char/broadcom/rpivid-mem.c
17 @@ -201,9 +201,14 @@ static int rpivid_mem_probe(struct platf
21 - (void)device_create(priv->class, NULL, priv->devid + 1, NULL,
23 + dev = device_create(priv->class, NULL, priv->devid + 1, NULL,
29 + goto failed_legacy_device_create;
33 dev_info(priv->dev, "%s initialised: Registers at 0x%08lx length 0x%08lx",
34 @@ -211,6 +216,8 @@ static int rpivid_mem_probe(struct platf
38 +failed_legacy_device_create:
39 + device_destroy(priv->class, priv->devid);
41 class_destroy(priv->class);