Re: [PATCH] PCI: kirin: Make structure kirin_dw_pcie_ops constant

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 19, 2019 at 01:09:46PM +0530, Nishka Dasgupta wrote:
> Static variable kirin_dw_pcie_ops, of type dw_pcie_ops, is used only
> once, when it is assigned to the constant field ops of variable pci
> (having type dw_pcie). Hence kirin_dw_pcie_ops is never modified.
> Therefore, make it constant to protect it from unintended modification.
> Issue found with Coccinelle.
> 
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@xxxxxxxxx>
> ---
>  drivers/pci/controller/dwc/pcie-kirin.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c
> index 8df1914226be..c19617a912bd 100644
> --- a/drivers/pci/controller/dwc/pcie-kirin.c
> +++ b/drivers/pci/controller/dwc/pcie-kirin.c
> @@ -436,7 +436,7 @@ static int kirin_pcie_host_init(struct pcie_port *pp)
>  	return 0;
>  }
>  
> -static struct dw_pcie_ops kirin_dw_pcie_ops = {
> +static const struct dw_pcie_ops kirin_dw_pcie_ops = {
>  	.read_dbi = kirin_pcie_read_dbi,
>  	.write_dbi = kirin_pcie_write_dbi,
>  	.link_up = kirin_pcie_link_up,

This makes sense, and const is applied to the same structure in many of
the other controller drivers.

Reviewed-by: Andrew Murray <andrew.murray@xxxxxxx>

> -- 
> 2.19.1
> 



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux