All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephane Grosjean <s.grosjean@peak-system.com>
To: linux-can Mailing List <linux-can@vger.kernel.org>
Cc: Stephane Grosjean <s.grosjean@peak-system.com>
Subject: [PATCH 1/5] can: peak_usb: pcan_usb_get_device_id(): read value only in case of success
Date: Fri, 25 Jun 2021 15:09:27 +0200	[thread overview]
Message-ID: <20210625130931.27438-2-s.grosjean@peak-system.com> (raw)
In-Reply-To: <20210625130931.27438-1-s.grosjean@peak-system.com>

In case of error, reading value from response argument is useless.

Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
---
 drivers/net/can/usb/peak_usb/pcan_usb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/usb/peak_usb/pcan_usb.c b/drivers/net/can/usb/peak_usb/pcan_usb.c
index 1d6f77252f01..9f3e16684e28 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb.c
@@ -384,7 +384,8 @@ static int pcan_usb_get_device_id(struct peak_usb_device *dev, u32 *device_id)
 	if (err)
 		netdev_err(dev->netdev, "getting device id failure: %d\n", err);
 
-	*device_id = args[0];
+	else
+		*device_id = args[0];
 
 	return err;
 }
-- 
2.25.1


  reply	other threads:[~2021-06-25 13:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-25 13:09 [PATCH 0/5] can: peak_usb: upgrade driver for PCAN-USB Stephane Grosjean
2021-06-25 13:09 ` Stephane Grosjean [this message]
2021-06-25 13:09 ` [PATCH 2/5] can: peak_usb: PCAN-USB: add support of loopback and one-short mode Stephane Grosjean
2021-06-28  7:00   ` Marc Kleine-Budde
2021-06-25 13:09 ` [PATCH 3/5] can: peak_usb: pcan_usb_handle_bus_evt(): fix reading rxerr/txerr values Stephane Grosjean
2021-06-28  6:52   ` Marc Kleine-Budde
2021-06-25 13:09 ` [PATCH 4/5] can: peak_usb: pcan_usb_encode_msg(): adds information Stephane Grosjean
2021-06-25 13:09 ` [PATCH 5/5] can: peak_usb: upgrades the handling of bus state changes Stephane Grosjean
2021-06-28  6:54   ` Marc Kleine-Budde
2021-06-28  6:57 ` [PATCH 0/5] can: peak_usb: upgrade driver for PCAN-USB Marc Kleine-Budde

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=20210625130931.27438-2-s.grosjean@peak-system.com \
    --to=s.grosjean@peak-system.com \
    --cc=linux-can@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.