Subject: Re: [PATCH V2 2/3] net: dsa: ksz: Factor out common tag code

From: Andrew Lunn <[email-masked]>
Date: Fri, 14 Dec 2018 10:05:25 +0100

> +static struct sk_buff *ksz_common_xmit(struct sk_buff *skb,
> +				       struct net_device *dev, int len)
>  {
> -	struct dsa_port *dp = dsa_slave_to_port(dev);
>  	struct sk_buff *nskb;
>  	int padlen;
> -	u8 *tag;
>  
>  	padlen = (skb->len >= ETH_ZLEN) ? 0 : ETH_ZLEN - skb->len;
>  
> -	if (skb_tailroom(skb) >= padlen + KSZ_INGRESS_TAG_LEN) {
> +	if (skb_tailroom(skb) >= padlen + len) {
>  		/* Let dsa_slave_xmit() free skb */
>  		if (__skb_put_padto(skb, skb->len + padlen, false))
>  			return NULL;

Hi Marek

This can return NULL.

> +static struct sk_buff *ksz9477_xmit(struct sk_buff *skb,
> +				    struct net_device *dev)
> +{
> +	struct dsa_port *dp = dsa_slave_to_port(dev);
> +	struct sk_buff *nskb;
> +	u16 *tag;
> +	u8 *addr;
> +
> +	nskb = ksz_common_xmit(skb, dev, KSZ9477_INGRESS_TAG_LEN);

So here you need to check for NULL

Otherwise, i like it. Thanks for removing the function pointer.

	   Andrew