Re: [PATCH] drivers/bluetooth: Convert kfree to kfree_skb

From: Julia Lawall
Date: Wed Nov 21 2007 - 05:15:42 EST


Please ignore this patch. In the case of btsdio.c, the enclosing function
is used as an interrupt handler, so it should not use kfree_skb either.

julia



On Tue, 20 Nov 2007, Julia Lawall wrote:

> From: Julia Lawall <julia@xxxxxxx>
>
> kfree_skb rather than kfree should be used for values of type struct
> sk_buff *.
>
> This was fixed using the following semantic patch
> (http://www.emn.fr/x-info/coccinelle/).
>
> // <smpl>
> @@
> struct sk_buff *skb;
> @@
>
> - kfree(skb)
> + kfree_skb(skb)
> // </smpl>
>
> Signed-off-by: Julia Lawall <julia@xxxxxxx>
> ---
>
> diff -u -p a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c
> --- a/drivers/bluetooth/bpa10x.c 2007-11-01 10:30:39.000000000 +0100
> +++ b/drivers/bluetooth/bpa10x.c 2007-11-20 21:07:42.000000000 +0100
> @@ -446,8 +446,8 @@ static void bpa10x_destruct(struct hci_d
>
> BT_DBG("%s", hdev->name);
>
> - kfree(data->rx_skb[0]);
> - kfree(data->rx_skb[1]);
> + kfree_skb(data->rx_skb[0]);
> + kfree_skb(data->rx_skb[1]);
> kfree(data);
> }
>
> diff -u -p a/drivers/bluetooth/btsdio.c b/drivers/bluetooth/btsdio.c
> --- a/drivers/bluetooth/btsdio.c 2007-11-01 10:30:39.000000000 +0100
> +++ b/drivers/bluetooth/btsdio.c 2007-11-20 21:07:44.000000000 +0100
> @@ -152,7 +152,7 @@ static int btsdio_rx_packet(struct btsdi
>
> err = sdio_readsb(data->func, skb->data, REG_RDAT, len - 4);
> if (err < 0) {
> - kfree(skb);
> + kfree_skb(skb);
> return err;
> }
>
> @@ -163,7 +163,7 @@ static int btsdio_rx_packet(struct btsdi
>
> err = hci_recv_frame(skb);
> if (err < 0) {
> - kfree(skb);
> + kfree_skb(skb);
> return err;
> }
>
>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/