diff mbox series

[v1,1/1] i2c: robotfuzz-osif: Propagate parent device to I2C core

Message ID 20220204151726.8924-1-andriy.shevchenko@linux.intel.com
State New
Headers show
Series [v1,1/1] i2c: robotfuzz-osif: Propagate parent device to I2C core | expand

Commit Message

Andy Shevchenko Feb. 4, 2022, 3:17 p.m. UTC
I2C core might use parent device to retrieve properties of
the controller. Propagate parent device for that.

Fixes: 83e53a8f120f ("i2c: Add bus driver for for OSIF USB i2c device.")
Reported-by: syzbot+0591ccf54ee05344e4eb@syzkaller.appspotmail.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/i2c/busses/i2c-robotfuzz-osif.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Wolfram Sang Feb. 18, 2022, 2:22 p.m. UTC | #1
> +	struct device *dev = &interface->dev;

This now creates a mixture of 'dev' and '&interface->dev'...

> +	priv->adapter.dev.parent = dev;

I propose to use &interface->dev here in this patch and convert to dev
in a later patch?
Andy Shevchenko Feb. 20, 2022, 10:57 a.m. UTC | #2
On Fri, Feb 18, 2022 at 03:22:19PM +0100, Wolfram Sang wrote:
> 
> > +	struct device *dev = &interface->dev;
> 
> This now creates a mixture of 'dev' and '&interface->dev'...
> 
> > +	priv->adapter.dev.parent = dev;
> 
> I propose to use &interface->dev here in this patch and convert to dev
> in a later patch?

Why not?
Will do for next version (next week).
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-robotfuzz-osif.c b/drivers/i2c/busses/i2c-robotfuzz-osif.c
index 66dfa211e736..bfbfa0d07bb2 100644
--- a/drivers/i2c/busses/i2c-robotfuzz-osif.c
+++ b/drivers/i2c/busses/i2c-robotfuzz-osif.c
@@ -128,6 +128,7 @@  MODULE_DEVICE_TABLE(usb, osif_table);
 static int osif_probe(struct usb_interface *interface,
 			     const struct usb_device_id *id)
 {
+	struct device *dev = &interface->dev;
 	int ret;
 	struct osif_priv *priv;
 	u16 version;
@@ -145,6 +146,7 @@  static int osif_probe(struct usb_interface *interface,
 	priv->adapter.class = I2C_CLASS_HWMON;
 	priv->adapter.algo = &osif_algorithm;
 	priv->adapter.algo_data = priv;
+	priv->adapter.dev.parent = dev;
 	snprintf(priv->adapter.name, sizeof(priv->adapter.name),
 		 "OSIF at bus %03d device %03d",
 		 priv->usb_dev->bus->busnum, priv->usb_dev->devnum);