]> 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:17:13 +0000 (13:17 +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 42805dfbffeb99c0c3a8970fe62261183fdd9ec3..06edbe8749c6489a5092d306ecb64e86f19aadf2 100644 (file)
@@ -2327,11 +2327,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;
                }