diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2017-12-19 21:59:48 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-12-29 12:24:44 +0100 |
commit | cae8b2e138fab548c9a55f022f8bab4cba300414 (patch) | |
tree | 550886806627a3e9fb73bd2b96334188b8c0d948 /drivers/staging | |
parent | media: staging: atomisp2: replace DEVICE_ATTR with DEVICE_ATTR_RO (diff) | |
download | linux-cae8b2e138fab548c9a55f022f8bab4cba300414.tar.xz linux-cae8b2e138fab548c9a55f022f8bab4cba300414.zip |
media: staging: atomisp: Don't leak GPIO resources if clk_get() failed
In case devm_clk_get() call fails the previously requested GPIOs are
left requested.
Fix this by moving GPIO request code after devm_clk_get() call.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c index bf9f34b7ad72..a5d0dd88a8bc 100644 --- a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c +++ b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c @@ -322,8 +322,6 @@ static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev) VLV2_CLK_PLL_19P2MHZ); gmin_subdevs[i].csi_port = gmin_get_var_int(dev, "CsiPort", 0); gmin_subdevs[i].csi_lanes = gmin_get_var_int(dev, "CsiLanes", 1); - gmin_subdevs[i].gpio0 = gpiod_get_index(dev, NULL, 0, GPIOD_OUT_LOW); - gmin_subdevs[i].gpio1 = gpiod_get_index(dev, NULL, 1, GPIOD_OUT_LOW); /* get PMC clock with clock framework */ snprintf(gmin_pmc_clk_name, @@ -356,9 +354,11 @@ static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev) if (!ret) clk_disable_unprepare(gmin_subdevs[i].pmc_clk); + gmin_subdevs[i].gpio0 = gpiod_get_index(dev, NULL, 0, GPIOD_OUT_LOW); if (IS_ERR(gmin_subdevs[i].gpio0)) gmin_subdevs[i].gpio0 = NULL; + gmin_subdevs[i].gpio1 = gpiod_get_index(dev, NULL, 1, GPIOD_OUT_LOW); if (IS_ERR(gmin_subdevs[i].gpio1)) gmin_subdevs[i].gpio1 = NULL; |