Message ID | edc347e3-52d8-9621-c3f1-5c3872d95fcb@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] Input: iforce - add missing vendor and product ids to the Unknown device name | expand |
Hi Greg, On Mon, Aug 29, 2022 at 11:45:18AM +0200, Greg Tulli wrote: > > An unknown iforce device is named "Unknown I-Force Device > [%04x:%04x]". The vendor and product ids should be substituted. > > Signed-off-by: Greg Tulli <greg.iforce@gmail.com> > --- > > diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c > index b2a68bc9f0b4..6de5d06d2bd0 100644 > --- a/drivers/input/joystick/iforce/iforce-main.c > +++ b/drivers/input/joystick/iforce/iforce-main.c > @@ -323,7 +323,11 @@ int iforce_init_device(struct device *parent, u16 bustype, > break; > > iforce->type = iforce_device + i; > - input_dev->name = iforce->type->name; > + if (iforce_device[i].idvendor) If we are using iforce->type then we should say if (iforce->type->idVendor) > + input_dev->name = iforce->type->name; > + else > + input_dev->name = devm_kasprintf(parent, GFP_KERNEL, iforce->type->name, > + input_dev->id.vendor, input_dev->id.product); This needs error handling. > > /* > * Set input device bitfields and ranges. Thanks.
diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c index b2a68bc9f0b4..6de5d06d2bd0 100644 --- a/drivers/input/joystick/iforce/iforce-main.c +++ b/drivers/input/joystick/iforce/iforce-main.c @@ -323,7 +323,11 @@ int iforce_init_device(struct device *parent, u16 bustype, break; iforce->type = iforce_device + i; - input_dev->name = iforce->type->name; + if (iforce_device[i].idvendor) + input_dev->name = iforce->type->name; + else + input_dev->name = devm_kasprintf(parent, GFP_KERNEL, iforce->type->name, + input_dev->id.vendor, input_dev->id.product); /* * Set input device bitfields and ranges.
An unknown iforce device is named "Unknown I-Force Device [%04x:%04x]". The vendor and product ids should be substituted. Signed-off-by: Greg Tulli <greg.iforce@gmail.com> ---