gpio fixes for v6.7-rc5

- fix an error path after a failed export in sysfs code
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAmV0wIYACgkQEacuoBRx
 13Jt5A//dcrJanDY/ydioCg7FxGWPktQVsquFWELpT+rzVNxGdUTmE/pn3o5axSE
 +VdwUg6L4kLO85TZkzo3wvGVgf9gSYDXu/sgBRilF9OTmAPCoZrAjMfIYFEelWCs
 n/dk2VfdG+Hbf5S1JuN0svUAmqzW6xrtGXE5enxLPqexWuB+YFhnUmjWZlIMxHYj
 MVATWENwFnzl00K1ApXH/Nt0RHa/FRMkTOr3pa7C21tL9s6c4KKq0wLwR9vYLA2e
 7wMLKgKhL5jRnjx7PgHL3F/V1AEJzNlPFtmPzvIOz1IQBN5jpsbFfhaI/F6yLuKV
 bNT3rrKtMaNfvI/RmVXmTSNdhUg5tmL5y+mC0CBOnoUwVC1/DIlxro0PCO9HM+c0
 elACsdm531Wmz95hXmh6YeMaEgD+zehH/5N4pd1U67fSJsJuxjhbRByLhQpNMJCz
 AoppNb8zKYoPYOkl8MyCxLEje0dsAy3UFEYvnLTrTDx5UgxrgISDw2PqxFNzav20
 AgrQ8NJzLI2tQVyEhf5PZsozEmgNfKZYZYx93fUIVYys17Mfv5W8s2hr0AOVfinz
 V/cuqpkfWtATVbLmoBEc86raHz4KKegPs8Q/Kb10xmjtXh76k+Rap4V+/GQjb+Q5
 4mhGbttp1WUaY/BVxWKd9myCwhn4sasEYgSUvI1CmVeDCDEqkK4=
 =Zzhe
 -----END PGP SIGNATURE-----

Merge tag 'gpio-fixes-for-v6.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux

Pull gpio fix from Bartosz Golaszewski:

 - fix an error path after a failed export in sysfs code

* tag 'gpio-fixes-for-v6.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
  gpiolib: sysfs: Fix error handling on failed export
This commit is contained in:
Linus Torvalds 2023-12-09 19:21:44 -08:00
commit 99d4cf7659
1 changed files with 9 additions and 6 deletions

View File

@ -474,14 +474,17 @@ static ssize_t export_store(const struct class *class,
goto done;
status = gpiod_set_transitory(desc, false);
if (!status) {
status = gpiod_export(desc, true);
if (status < 0)
gpiod_free(desc);
else
set_bit(FLAG_SYSFS, &desc->flags);
if (status) {
gpiod_free(desc);
goto done;
}
status = gpiod_export(desc, true);
if (status < 0)
gpiod_free(desc);
else
set_bit(FLAG_SYSFS, &desc->flags);
done:
if (status)
pr_debug("%s: status %d\n", __func__, status);