media: atomisp: add error checking to atomisp_create_pipes_stream()
authorHans de Goede <hdegoede@redhat.com>
Wed, 15 Jun 2022 20:50:31 +0000 (21:50 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 8 Jul 2022 15:38:10 +0000 (16:38 +0100)
The functions called by atomisp_create_pipes_stream() can fail,
add error checking for them.

Link: https://lore.kernel.org/linux-media/20220615205037.16549-35-hdegoede@redhat.com
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/staging/media/atomisp/pci/atomisp_compat.h
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
drivers/staging/media/atomisp/pci/atomisp_ioctl.c

index 809f1a8c997429e389b4c2f8f1df4c471f72ff84..3393ae6824f0a1790b814b74552225d51a9b119b 100644 (file)
@@ -240,7 +240,7 @@ int atomisp_css_input_configure_port(struct atomisp_sub_device *asd,
                                     unsigned int metadata_width,
                                     unsigned int metadata_height);
 
-void atomisp_create_pipes_stream(struct atomisp_sub_device *asd);
+int atomisp_create_pipes_stream(struct atomisp_sub_device *asd);
 void atomisp_destroy_pipes_stream_force(struct atomisp_sub_device *asd);
 
 void atomisp_css_stop(struct atomisp_sub_device *asd,
index d03b29add5c36f7152616a97a9a626ec14cf9c60..6375cfb839d4c562589c3166cbaa08ca801fd883 100644 (file)
@@ -785,10 +785,24 @@ pipe_err:
        return -EINVAL;
 }
 
-void atomisp_create_pipes_stream(struct atomisp_sub_device *asd)
+int atomisp_create_pipes_stream(struct atomisp_sub_device *asd)
 {
-       __create_pipes(asd);
-       __create_streams(asd);
+       int ret;
+
+       ret = __create_pipes(asd);
+       if (ret) {
+               dev_err(asd->isp->dev, "create pipe failed %d.\n", ret);
+               return ret;
+       }
+
+       ret = __create_streams(asd);
+       if (ret) {
+               dev_warn(asd->isp->dev, "create stream failed %d.\n", ret);
+               __destroy_pipes(asd, true);
+               return ret;
+       }
+
+       return 0;
 }
 
 int atomisp_css_update_stream(struct atomisp_sub_device *asd)
index 73906902600ca5fe5f1a3489675c6248e4fb6248..459645c2e2a73cc53730fad390e204ac5ff3a155 100644 (file)
@@ -2267,8 +2267,17 @@ stopsensor:
                dev_err(isp->dev, "atomisp_reset");
                atomisp_reset(isp);
                for (i = 0; i < isp->num_of_streams; i++) {
-                       if (recreate_streams[i])
-                               atomisp_create_pipes_stream(&isp->asd[i]);
+                       if (recreate_streams[i]) {
+                               int ret2;
+
+                               ret2 = atomisp_create_pipes_stream(&isp->asd[i]);
+                               if (ret2) {
+                                       dev_err(isp->dev, "%s error re-creating streams: %d\n",
+                                               __func__, ret2);
+                                       if (!ret)
+                                               ret = ret2;
+                               }
+                       }
                }
                isp->isp_timeout = false;
        }