[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200902145701.GA624583@rowland.harvard.edu>
Date: Wed, 2 Sep 2020 10:57:01 -0400
From: Alan Stern <stern@...land.harvard.edu>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: himadrispandya@...il.com, dvyukov@...gle.com,
linux-usb@...r.kernel.org, perex@...ex.cz, tiwai@...e.com,
stern@...land.harvard.ed, linux-kernel@...r.kernel.org,
marcel@...tmann.org, johan.hedberg@...il.com,
linux-bluetooth@...r.kernel.org, alsa-devel@...a-project.org
Subject: Re: [PATCH 04/10] USB: core: hub.c: use usb_control_msg_send() in a
few places
On Wed, Sep 02, 2020 at 01:01:06PM +0200, Greg Kroah-Hartman wrote:
> There are a few calls to usb_control_msg() that can be converted to use
> usb_control_msg_send() instead, so do that in order to make the error
> checking a bit simpler and the code smaller.
>
> Cc: Alan Stern <stern@...land.harvard.edu>
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
One problem in this patch...
> @@ -3896,27 +3875,14 @@ static int usb_req_set_sel(struct usb_device *udev, enum usb3_link_state state)
> if (u2_pel > USB3_LPM_MAX_U2_SEL_PEL)
> u2_pel = USB3_LPM_MAX_U2_SEL_PEL;
>
> - /*
> - * usb_enable_lpm() can be called as part of a failed device reset,
> - * which may be initiated by an error path of a mass storage driver.
> - * Therefore, use GFP_NOIO.
> - */
> - sel_values = kmalloc(sizeof *(sel_values), GFP_NOIO);
> - if (!sel_values)
> - return -ENOMEM;
> -
> - sel_values->u1_sel = u1_sel;
> - sel_values->u1_pel = u1_pel;
> - sel_values->u2_sel = cpu_to_le16(u2_sel);
> - sel_values->u2_pel = cpu_to_le16(u2_pel);
> + sel_values.u1_sel = u1_sel;
> + sel_values.u1_pel = u1_pel;
> + sel_values.u2_sel = cpu_to_le16(u2_sel);
> + sel_values.u2_pel = cpu_to_le16(u2_pel);
>
> - ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
> - USB_REQ_SET_SEL,
> - USB_RECIP_DEVICE,
> - 0, 0,
> - sel_values, sizeof *(sel_values),
> - USB_CTRL_SET_TIMEOUT);
> - kfree(sel_values);
> + ret = usb_control_msg_send(udev, 0, USB_REQ_SET_SEL, USB_RECIP_DEVICE,
> + 0, 0, &sel_values, sizeof(sel_values),
> + USB_CTRL_SET_TIMEOUT);
This effectively changes GFP_NOIO to GFP_KERNEL. Probably you should
leave this particular call alone.
Alan Stern
Powered by blists - more mailing lists