diff mbox series

usb: serial: digi_acceleport: Enhance error handling by checkpatch.pl

Message ID 20240922211512.49273-1-didi1364@gmail.com (mailing list archive)
State New
Headers show
Series usb: serial: digi_acceleport: Enhance error handling by checkpatch.pl | expand

Commit Message

amin-amani Sept. 22, 2024, 9:15 p.m. UTC
- Separated null checks for port, serial and private data.

Signed-off-by: amin-amani <didi1364@gmail.com>
---
 drivers/usb/serial/digi_acceleport.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Greg KH Sept. 23, 2024, 6:47 a.m. UTC | #1
On Mon, Sep 23, 2024 at 12:45:12AM +0330, amin-amani wrote:
> - Separated null checks for port, serial and private data.
> 
> Signed-off-by: amin-amani <didi1364@gmail.com>
> ---
>  drivers/usb/serial/digi_acceleport.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- You did not specify a description of why the patch is needed, or
  possibly, any description at all, in the email body.  Please read the
  section entitled "The canonical patch format" in the kernel file,
  Documentation/process/submitting-patches.rst for what is needed in
  order to properly describe the change.

- You did not write a descriptive Subject: for the patch, allowing Greg,
  and everyone else, to know what this patch is all about.  Please read
  the section entitled "The canonical patch format" in the kernel file,
  Documentation/process/submitting-patches.rst for what a proper
  Subject: line should look like.

- It looks like you did not use your "real" name for the patch on either
  the Signed-off-by: line, or the From: line (both of which have to
  match).  Please read the kernel file,
  Documentation/process/submitting-patches.rst for how to do this
  correctly.

- This looks like a new version of a previously submitted patch, but you
  did not list below the --- line any changes from the previous version.
  Please read the section entitled "The canonical patch format" in the
  kernel file, Documentation/process/submitting-patches.rst for what
  needs to be done here to properly describe this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot
Greg KH Sept. 23, 2024, 6:49 a.m. UTC | #2
On Mon, Sep 23, 2024 at 12:45:12AM +0330, amin-amani wrote:
> - Separated null checks for port, serial and private data.
> 
> Signed-off-by: amin-amani <didi1364@gmail.com>
> ---
>  drivers/usb/serial/digi_acceleport.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)

Hint, when working on a "first patch" for cleanups like this, please
work in the drivers/staging/ portion of the kernel, as that is where
stuff like this is encouraged.  Only after getting experience in the
development process should you venture out into other areas.

Also, for drivers like this, if you do not have the hardware, and can
test your changes, it can be hard to justify taking the commit.

> diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
> index d1dea3850576..d858358f94d8 100644
> --- a/drivers/usb/serial/digi_acceleport.c
> +++ b/drivers/usb/serial/digi_acceleport.c
> @@ -1309,9 +1309,14 @@ static void digi_read_bulk_callback(struct urb *urb)
>  			__func__, status);
>  		return;
>  	}
> -	if (port->serial == NULL ||
> -		(serial_priv = usb_get_serial_data(port->serial)) == NULL) {
> -		dev_err(&port->dev, "%s: serial is bad or serial->private "
> +	if (port->serial == NULL) {
> +		dev_err(&port->dev, "%s: serial is bad,"
> +			" status=%d\n", __func__, status);
> +		return;
> +	}
> +	serial_priv = usb_get_serial_data(port->serial);
> +	if (serial_priv == NULL) {
> +		dev_err(&port->dev, "%s:serial->private "

Also, what does this really provide?  Is it more helpful to you to see 2
different strings for this error?  Have you hit this before, and if so,
we should fix the root problem here instead, right?

thanks,

greg k-h
diff mbox series

Patch

diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index d1dea3850576..d858358f94d8 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -1309,9 +1309,14 @@  static void digi_read_bulk_callback(struct urb *urb)
 			__func__, status);
 		return;
 	}
-	if (port->serial == NULL ||
-		(serial_priv = usb_get_serial_data(port->serial)) == NULL) {
-		dev_err(&port->dev, "%s: serial is bad or serial->private "
+	if (port->serial == NULL) {
+		dev_err(&port->dev, "%s: serial is bad,"
+			" status=%d\n", __func__, status);
+		return;
+	}
+	serial_priv = usb_get_serial_data(port->serial);
+	if (serial_priv == NULL) {
+		dev_err(&port->dev, "%s:serial->private "
 			"is NULL, status=%d\n", __func__, status);
 		return;
 	}