]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
media: smiapp: Fix error handling at NVM reading
authorSakari Ailus <sakari.ailus@linux.intel.com>
Mon, 23 Sep 2019 14:25:42 +0000 (11:25 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Oct 2020 11:12:27 +0000 (13:12 +0200)
[ Upstream commit a5b1d5413534607b05fb34470ff62bf395f5c8d0 ]

If NVM reading failed, the device was left powered on. Fix that.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/i2c/smiapp/smiapp-core.c

index e4d7f2febf00ce0f5fb24227bc0228d325d49955..05b3974bd9202963d31f8bf7fd8f2ea1b12fe64d 100644 (file)
@@ -2338,11 +2338,12 @@ smiapp_sysfs_nvm_read(struct device *dev, struct device_attribute *attr,
                if (rval < 0) {
                        if (rval != -EBUSY && rval != -EAGAIN)
                                pm_runtime_set_active(&client->dev);
-                       pm_runtime_put(&client->dev);
+                       pm_runtime_put_noidle(&client->dev);
                        return -ENODEV;
                }
 
                if (smiapp_read_nvm(sensor, sensor->nvm)) {
+                       pm_runtime_put(&client->dev);
                        dev_err(&client->dev, "nvm read failed\n");
                        return -ENODEV;
                }