]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Bluetooth: hci_qca: Make structure qca_proto constant
authorNishka Dasgupta <nishkadg.linux@gmail.com>
Thu, 15 Aug 2019 05:51:49 +0000 (11:21 +0530)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 5 Sep 2019 15:27:21 +0000 (17:27 +0200)
Static structure qca_proto, of type hci_uart_proto, is used four times:
as the last argument in function hci_uart_register_device(), and as the
only argument to functions hci_uart_register_proto() and
hci_uart_unregister_proto(). In all three of these functions, the
parameter corresponding to qca_proto is declared as constant. Therefore,
make qca_proto itself constant as well in order to protect it from
unintended modification.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/hci_qca.c

index f4142d195e0301b08f64c17c6eb9c8dbf7df6df7..0cf5320716640d94c2459fc8fe1c61263706fa82 100644 (file)
@@ -1307,7 +1307,7 @@ static int qca_setup(struct hci_uart *hu)
        return ret;
 }
 
-static struct hci_uart_proto qca_proto = {
+static const struct hci_uart_proto qca_proto = {
        .id             = HCI_UART_QCA,
        .name           = "QCA",
        .manufacturer   = 29,