Re: [PATCH v1] mfd: dln2: Fix sanity checking for endpoints

From: Lee Jones
Date: Wed Feb 26 2020 - 03:49:37 EST


On Tue, 18 Feb 2020, Andy Shevchenko wrote:

> While the commit 2b8bd606b1e6 ("mfd: dln2: More sanity checking for endpoints")
> tries to harden the sanity checks it made at the same time a regression,
> i.e. mixed in and out endpoints. Obviously it should have been not tested on
> real hardware at that time, but unluckily it didn't happen.

This is why I usually insist on defining magic numbers.

That would be a better solution I feel.

> So, fix above mentioned typo and make device being enumerated again.
>
> Fixes: 2b8bd606b1e6 ("mfd: dln2: More sanity checking for endpoints")
> Cc: Oliver Neukum <oneukum@xxxxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
> drivers/mfd/dln2.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
> index 984d6b438aca..3a729b196b1f 100644
> --- a/drivers/mfd/dln2.c
> +++ b/drivers/mfd/dln2.c
> @@ -754,8 +754,8 @@ static int dln2_probe(struct usb_interface *interface,
> hostif->desc.bNumEndpoints < 2)
> return -ENODEV;
>
> - epin = &hostif->endpoint[0].desc;
> - epout = &hostif->endpoint[1].desc;
> + epin = &hostif->endpoint[1].desc;
> + epout = &hostif->endpoint[0].desc;
> if (!usb_endpoint_is_bulk_out(epout))
> return -ENODEV;
> if (!usb_endpoint_is_bulk_in(epin))

--
Lee Jones [æçæ]
Linaro Services Technical Lead
Linaro.org â Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog