* [PATCH] media: marvell-ccic: set error code in probe
@ 2021-05-26 14:35 Evgeny Novikov
2021-05-26 14:49 ` Sakari Ailus
0 siblings, 1 reply; 2+ messages in thread
From: Evgeny Novikov @ 2021-05-26 14:35 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Evgeny Novikov, Jacopo Mondi, Ezequiel Garcia, Sakari Ailus,
Hans Verkuil, Lubomir Rintel, Vaibhav Gupta, Leon Romanovsky,
Laurent Pinchart, linux-media, linux-kernel, ldv-project
When i2c_new_client_device() fails, cafe_pci_probe() cleans up all
resources and returns 0. The patch sets the error code on the
corresponding path.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Evgeny Novikov <novikov@ispras.ru>
---
drivers/media/platform/marvell-ccic/cafe-driver.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/marvell-ccic/cafe-driver.c b/drivers/media/platform/marvell-ccic/cafe-driver.c
index baac86f3d153..9aa374fa8b36 100644
--- a/drivers/media/platform/marvell-ccic/cafe-driver.c
+++ b/drivers/media/platform/marvell-ccic/cafe-driver.c
@@ -486,6 +486,7 @@ static int cafe_pci_probe(struct pci_dev *pdev,
struct cafe_camera *cam;
struct mcam_camera *mcam;
struct v4l2_async_subdev *asd;
+ struct i2c_client *i2c_dev;
/*
* Start putting together one of our big camera structures.
@@ -561,11 +562,16 @@ static int cafe_pci_probe(struct pci_dev *pdev,
clkdev_create(mcam->mclk, "xclk", "%d-%04x",
i2c_adapter_id(cam->i2c_adapter), ov7670_info.addr);
- if (!IS_ERR(i2c_new_client_device(cam->i2c_adapter, &ov7670_info))) {
- cam->registered = 1;
- return 0;
+ i2c_dev = i2c_new_client_device(cam->i2c_adapter, &ov7670_info);
+ if (IS_ERR(i2c_dev)) {
+ ret = PTR_ERR(i2c_dev);
+ goto out_mccic_shutdown;
}
+ cam->registered = 1;
+ return 0;
+
+out_mccic_shutdown:
mccic_shutdown(mcam);
out_smbus_shutdown:
cafe_smbus_shutdown(cam);
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] media: marvell-ccic: set error code in probe
2021-05-26 14:35 [PATCH] media: marvell-ccic: set error code in probe Evgeny Novikov
@ 2021-05-26 14:49 ` Sakari Ailus
0 siblings, 0 replies; 2+ messages in thread
From: Sakari Ailus @ 2021-05-26 14:49 UTC (permalink / raw)
To: Evgeny Novikov
Cc: Mauro Carvalho Chehab, Jacopo Mondi, Ezequiel Garcia,
Hans Verkuil, Lubomir Rintel, Vaibhav Gupta, Leon Romanovsky,
Laurent Pinchart, linux-media, linux-kernel, ldv-project
On Wed, May 26, 2021 at 05:35:06PM +0300, Evgeny Novikov wrote:
> When i2c_new_client_device() fails, cafe_pci_probe() cleans up all
> resources and returns 0. The patch sets the error code on the
> corresponding path.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Evgeny Novikov <novikov@ispras.ru>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
--
Sakari Ailus
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-26 14:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-26 14:35 [PATCH] media: marvell-ccic: set error code in probe Evgeny Novikov
2021-05-26 14:49 ` Sakari Ailus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).