All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] can: peak_canfd: fix uninitialized symbol warnings
@ 2017-05-03  8:35 Stephane Grosjean
  2017-05-16 10:07 ` Stephane Grosjean
  0 siblings, 1 reply; 4+ messages in thread
From: Stephane Grosjean @ 2017-05-03  8:35 UTC (permalink / raw)
  To: Oliver Hartkopp; +Cc: linux-can Mailing List, Stephane Grosjean

This patch fixes two uninitialized symbol warnings in the new code adding
support of the PEAK-System PCAN-PCI Express FD boards, in the socket-CAN
network protocol family.

Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
---
 drivers/net/can/peak_canfd/peak_canfd.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/can/peak_canfd/peak_canfd.c b/drivers/net/can/peak_canfd/peak_canfd.c
index 0d57be5..912bd81 100644
--- a/drivers/net/can/peak_canfd/peak_canfd.c
+++ b/drivers/net/can/peak_canfd/peak_canfd.c
@@ -399,8 +399,9 @@ static int pucan_handle_status(struct peak_canfd_priv *priv,
 	} else if (priv->can.state != CAN_STATE_ERROR_ACTIVE) {
 		/* back to ERROR_ACTIVE */
 		netdev_dbg(ndev, "Error active status\n");
-		can_change_state(ndev, cf, CAN_STATE_ERROR_ACTIVE,
-				 CAN_STATE_ERROR_ACTIVE);
+		if (skb)
+			can_change_state(ndev, cf, CAN_STATE_ERROR_ACTIVE,
+					 CAN_STATE_ERROR_ACTIVE);
 	} else {
 		dev_kfree_skb(skb);
 		return 0;
@@ -489,7 +490,7 @@ int peak_canfd_handle_msgs_list(struct peak_canfd_priv *priv,
 				struct pucan_rx_msg *msg_list, int msg_count)
 {
 	void *msg_ptr = msg_list;
-	int i, msg_size;
+	int i, msg_size = 0;
 
 	for (i = 0; i < msg_count; i++) {
 		msg_size = peak_canfd_handle_msg(priv, msg_ptr);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] can: peak_canfd: fix uninitialized symbol warnings
  2017-05-03  8:35 [PATCH] can: peak_canfd: fix uninitialized symbol warnings Stephane Grosjean
@ 2017-05-16 10:07 ` Stephane Grosjean
  2017-05-16 10:21   ` Marc Kleine-Budde
  2017-05-18  8:21   ` Marc Kleine-Budde
  0 siblings, 2 replies; 4+ messages in thread
From: Stephane Grosjean @ 2017-05-16 10:07 UTC (permalink / raw)
  To: Oliver Hartkopp; +Cc: linux-can Mailing List

Hello Oliver,

Has this patch been pushed in Dave Miller's net-next tree please?

Best regards,

Stephane


Le 03/05/2017 à 10:35, Stephane Grosjean a écrit :
> This patch fixes two uninitialized symbol warnings in the new code adding
> support of the PEAK-System PCAN-PCI Express FD boards, in the socket-CAN
> network protocol family.
>
> Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
> ---
>   drivers/net/can/peak_canfd/peak_canfd.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/can/peak_canfd/peak_canfd.c b/drivers/net/can/peak_canfd/peak_canfd.c
> index 0d57be5..912bd81 100644
> --- a/drivers/net/can/peak_canfd/peak_canfd.c
> +++ b/drivers/net/can/peak_canfd/peak_canfd.c
> @@ -399,8 +399,9 @@ static int pucan_handle_status(struct peak_canfd_priv *priv,
>   	} else if (priv->can.state != CAN_STATE_ERROR_ACTIVE) {
>   		/* back to ERROR_ACTIVE */
>   		netdev_dbg(ndev, "Error active status\n");
> -		can_change_state(ndev, cf, CAN_STATE_ERROR_ACTIVE,
> -				 CAN_STATE_ERROR_ACTIVE);
> +		if (skb)
> +			can_change_state(ndev, cf, CAN_STATE_ERROR_ACTIVE,
> +					 CAN_STATE_ERROR_ACTIVE);
>   	} else {
>   		dev_kfree_skb(skb);
>   		return 0;
> @@ -489,7 +490,7 @@ int peak_canfd_handle_msgs_list(struct peak_canfd_priv *priv,
>   				struct pucan_rx_msg *msg_list, int msg_count)
>   {
>   	void *msg_ptr = msg_list;
> -	int i, msg_size;
> +	int i, msg_size = 0;
>   
>   	for (i = 0; i < msg_count; i++) {
>   		msg_size = peak_canfd_handle_msg(priv, msg_ptr);

-- 
Stéphane Grosjean
PEAK-System France
132, rue André Bisiaux
F54320 MAXEVILLE
Tél : +(33) 9.72.54.51.97

--
PEAK-System Technik GmbH
Sitz der Gesellschaft Darmstadt - HRB 9183 
Geschaeftsfuehrung: Alexander Gach / Uwe Wilhelm
--

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] can: peak_canfd: fix uninitialized symbol warnings
  2017-05-16 10:07 ` Stephane Grosjean
@ 2017-05-16 10:21   ` Marc Kleine-Budde
  2017-05-18  8:21   ` Marc Kleine-Budde
  1 sibling, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2017-05-16 10:21 UTC (permalink / raw)
  To: Stephane Grosjean, Oliver Hartkopp; +Cc: linux-can Mailing List


[-- Attachment #1.1: Type: text/plain, Size: 448 bytes --]

On 05/16/2017 12:07 PM, Stephane Grosjean wrote:
> Hello Oliver,
> 
> Has this patch been pushed in Dave Miller's net-next tree please?

Added to can.

Tnx,
Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] can: peak_canfd: fix uninitialized symbol warnings
  2017-05-16 10:07 ` Stephane Grosjean
  2017-05-16 10:21   ` Marc Kleine-Budde
@ 2017-05-18  8:21   ` Marc Kleine-Budde
  1 sibling, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2017-05-18  8:21 UTC (permalink / raw)
  To: Stephane Grosjean, Oliver Hartkopp; +Cc: linux-can Mailing List


[-- Attachment #1.1: Type: text/plain, Size: 2429 bytes --]

On 05/16/2017 12:07 PM, Stephane Grosjean wrote:
> Hello Oliver,
> 
> Has this patch been pushed in Dave Miller's net-next tree please?
> 
> Best regards,
> 
> Stephane
> 
> 
> Le 03/05/2017 à 10:35, Stephane Grosjean a écrit :
>> This patch fixes two uninitialized symbol warnings in the new code adding
>> support of the PEAK-System PCAN-PCI Express FD boards, in the socket-CAN
>> network protocol family.
>>
>> Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
>> ---
>>   drivers/net/can/peak_canfd/peak_canfd.c | 7 ++++---
>>   1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/can/peak_canfd/peak_canfd.c b/drivers/net/can/peak_canfd/peak_canfd.c
>> index 0d57be5..912bd81 100644
>> --- a/drivers/net/can/peak_canfd/peak_canfd.c
>> +++ b/drivers/net/can/peak_canfd/peak_canfd.c
>> @@ -399,8 +399,9 @@ static int pucan_handle_status(struct peak_canfd_priv *priv,
>>   	} else if (priv->can.state != CAN_STATE_ERROR_ACTIVE) {
>>   		/* back to ERROR_ACTIVE */
>>   		netdev_dbg(ndev, "Error active status\n");
>> -		can_change_state(ndev, cf, CAN_STATE_ERROR_ACTIVE,
>> -				 CAN_STATE_ERROR_ACTIVE);
>> +		if (skb)
>> +			can_change_state(ndev, cf, CAN_STATE_ERROR_ACTIVE,
>> +					 CAN_STATE_ERROR_ACTIVE);

Looking at this again...In case of a OOM situation, where skb is NULL,
skipping the can_change_state() will not update the state of the candev,
see:

http://elixir.free-electrons.com/linux/latest/source/drivers/net/can/dev.c#L378

What about making can_change_state() safe to be called with cf=NULL?

> diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
> index 611d16a7061d..ae4ed03dc642 100644
> --- a/drivers/net/can/dev.c
> +++ b/drivers/net/can/dev.c
> @@ -391,6 +391,9 @@ void can_change_state(struct net_device *dev, struct can_frame *cf,
>         can_update_state_error_stats(dev, new_state);
>         priv->state = new_state;
>  
> +       if (!cf)
> +               return;
> +
>         if (unlikely(new_state == CAN_STATE_BUS_OFF)) {
>                 cf->can_id |= CAN_ERR_BUSOFF;
>                 return;

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-05-18  8:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-03  8:35 [PATCH] can: peak_canfd: fix uninitialized symbol warnings Stephane Grosjean
2017-05-16 10:07 ` Stephane Grosjean
2017-05-16 10:21   ` Marc Kleine-Budde
2017-05-18  8:21   ` Marc Kleine-Budde

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.