Re: [PATCH 2/3] PCI/sysfs: Use __free() in reset_method_store()

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

 



On Mon, Oct 28, 2024 at 07:40:45PM +0200, Ilpo Järvinen wrote:
> @@ -1430,7 +1431,7 @@ static ssize_t reset_method_store(struct device *dev,
>  				  const char *buf, size_t count)
>  {
>  	struct pci_dev *pdev = to_pci_dev(dev);
> -	char *options, *tmp_options, *name;
> +	char *tmp_options, *name;
>  	int m, n;
>  	u8 reset_methods[PCI_NUM_RESET_METHODS] = { 0 };
>  
> @@ -1445,7 +1446,7 @@ static ssize_t reset_method_store(struct device *dev,
>  		return count;
>  	}
>  
> -	options = kstrndup(buf, count, GFP_KERNEL);
> +	char *options __free(kfree) = kstrndup(buf, count, GFP_KERNEL);

We should avoid mixing declarations with code. Please declare it with
the cleanup attribute at the top like before, and just initialize it to
NULL.




[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