public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Jules Maselbas <jules.maselbas@grenoble-inp.org>
To: kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] usb: max3421: unlock on error in max3421_hub_control()
Date: Fri, 27 Oct 2017 09:06:36 +0000	[thread overview]
Message-ID: <622639427.1520752.1509095196276.JavaMail.zimbra@grenoble-inp.org> (raw)
In-Reply-To: <20171027062620.emm5wwdv73kjjpvl@mwanda>

Hi,

> We can't return directly in max3421_hub_control(), we have to unlock
> first.
Yes you are right.
I think testing if pdata is null is not necessary as driver_probe will fail if
the device do not have a platform_data.

Jules.

> Fixes: 721fdc83b31b ("usb: max3421: Add devicetree support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c
> index 928a5aabee02..46a86a7f3360 100644
> --- a/drivers/usb/host/max3421-hcd.c
> +++ b/drivers/usb/host/max3421-hcd.c
> @@ -1704,7 +1704,8 @@ max3421_hub_control(struct usb_hcd *hcd, u16 type_req, u16
> value, u16 index,
> 	pdata = spi->dev.platform_data;
> 	if (!pdata) {
> 		dev_err(&spi->dev, "Device platform data is missing\n");
> -		return -EFAULT;
> +		retval = -EFAULT;
> +		goto unlock;
> 	}
> 
> 	switch (type_req) {
> @@ -1787,6 +1788,7 @@ max3421_hub_control(struct usb_hcd *hcd, u16 type_req, u16
> value, u16 index,
> 		retval = -EPIPE;
> 	}
> 
> +unlock:
> 	spin_unlock_irqrestore(&max3421_hcd->lock, flags);
> 	return retval;
>  }

  reply	other threads:[~2017-10-27  9:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-27  6:26 [PATCH] usb: max3421: unlock on error in max3421_hub_control() Dan Carpenter
2017-10-27  9:06 ` Jules Maselbas [this message]
2017-10-27  9:36 ` Dan Carpenter
2017-10-27 12:08 ` Jules Maselbas
2017-10-27 12:16 ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=622639427.1520752.1509095196276.JavaMail.zimbra@grenoble-inp.org \
    --to=jules.maselbas@grenoble-inp.org \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox