Re: [PATCH v2 10/10] gpiolib: remove gpiochip_is_requested()

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

 



On Thu, Nov 30, 2023 at 02:46:30PM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
> 
> We have no external users of gpiochip_is_requested(). Let's remove it
> and replace its internal calls with direct testing of the REQUESTED flag.

...

> -	cpy = kstrdup(label, GFP_KERNEL);
> -	if (!cpy)
> -		return ERR_PTR(-ENOMEM);
> +	scoped_guard(spinlock_irqsave, &gpio_lock) {
> +		if (!test_bit(FLAG_REQUESTED, &desc->flags))
> +			return NULL;

> +		cpy = kstrdup(desc->label, GFP_KERNEL);
> +		if (!cpy)
> +			return ERR_PTR(-ENOMEM);

You just introduced these lines earlier in the series, and here you moved
them again. With guard() instead it may be kept in a better shape.

> +	}

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux