]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/media/platform/atmel/atmel-isc.c
media: atmel: atmel-isc: fix asd memory allocation
[mirror_ubuntu-bionic-kernel.git] / drivers / media / platform / atmel / atmel-isc.c
index 13f1c1c797b06e5605ee1a4698fa7665722d941f..ad12bc4a996f106dc8fe7487da1a702ca36d7f6c 100644 (file)
@@ -2068,8 +2068,11 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)
                        break;
                }
 
-               subdev_entity->asd = devm_kzalloc(dev,
-                                    sizeof(*subdev_entity->asd), GFP_KERNEL);
+               /* asd will be freed by the subsystem once it's added to the
+                * notifier list
+                */
+               subdev_entity->asd = kzalloc(sizeof(*subdev_entity->asd),
+                                            GFP_KERNEL);
                if (!subdev_entity->asd) {
                        of_node_put(rem);
                        ret = -ENOMEM;
@@ -2215,6 +2218,7 @@ static int atmel_isc_probe(struct platform_device *pdev)
                                                   &subdev_entity->notifier);
                if (ret) {
                        dev_err(dev, "fail to register async notifier\n");
+                       kfree(subdev_entity->asd);
                        goto cleanup_subdev;
                }