public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Cc: johan@kernel.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] USB: serial: ftdi_sio: Add check for create_sysfs_attrs
Date: Fri, 2 Sep 2022 07:24:38 +0200	[thread overview]
Message-ID: <YxGTlhCVbv1LsO0K@kroah.com> (raw)
In-Reply-To: <20220902032002.3859368-1-jiasheng@iscas.ac.cn>

On Fri, Sep 02, 2022 at 11:20:02AM +0800, Jiasheng Jiang wrote:
> As create_sysfs_attrs() can return error number,
> it should be better to check the return value and
> deal with the exception.
> 
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
>  drivers/usb/serial/ftdi_sio.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
> index d5a3986dfee7..c28f894430a5 100644
> --- a/drivers/usb/serial/ftdi_sio.c
> +++ b/drivers/usb/serial/ftdi_sio.c
> @@ -2251,7 +2251,11 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port)
>  	if (read_latency_timer(port) < 0)
>  		priv->latency = 16;
>  	write_latency_timer(port);
> -	create_sysfs_attrs(port);
> +	result = create_sysfs_attrs(port);
> +	if (result) {
> +		remove_sysfs_attrs(port);
> +		return result;
> +	}

Again, this should be changed to use a default attribute group instead.
Please make that change.

thanks,

greg k-h

      reply	other threads:[~2022-09-02  5:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-02  3:20 [PATCH] USB: serial: ftdi_sio: Add check for create_sysfs_attrs Jiasheng Jiang
2022-09-02  5:24 ` Greg KH [this message]

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=YxGTlhCVbv1LsO0K@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=jiasheng@iscas.ac.cn \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@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