Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

greybus: gb-beagleplay: remove unneeded calls to devm_gpiod_put()

gb_fw_init() is only called in this driver's probe() and we abort the
probing if it fails. This means that calling devm_gpiod_put() in error
path is not required as devres will already manage the releasing of the
resources when the device is detached.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20250624133140.77980-1-brgl@bgdev.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Bartosz Golaszewski and committed by
Greg Kroah-Hartman
bd80e3cc 12c409aa

+8 -17
+8 -17
drivers/greybus/gb-beagleplay.c
··· 1039 1039 .cleanup = cc1352_cleanup 1040 1040 }; 1041 1041 1042 + /* 1043 + * Must only be called from probe() as the devres resources allocated here 1044 + * will only be released on driver detach. 1045 + */ 1042 1046 static int gb_fw_init(struct gb_beagleplay *bg) 1043 1047 { 1044 - int ret; 1045 1048 struct fw_upload *fwl; 1046 1049 struct gpio_desc *desc; 1047 1050 ··· 1063 1060 bg->bootloader_backdoor_gpio = desc; 1064 1061 1065 1062 desc = devm_gpiod_get(&bg->sd->dev, "reset", GPIOD_IN); 1066 - if (IS_ERR(desc)) { 1067 - ret = PTR_ERR(desc); 1068 - goto free_boot; 1069 - } 1063 + if (IS_ERR(desc)) 1064 + return PTR_ERR(desc); 1070 1065 bg->rst_gpio = desc; 1071 1066 1072 1067 fwl = firmware_upload_register(THIS_MODULE, &bg->sd->dev, "cc1352p7", 1073 1068 &cc1352_bootloader_ops, bg); 1074 - if (IS_ERR(fwl)) { 1075 - ret = PTR_ERR(fwl); 1076 - goto free_reset; 1077 - } 1069 + if (IS_ERR(fwl)) 1070 + return PTR_ERR(fwl); 1078 1071 bg->fwl = fwl; 1079 1072 1080 1073 return 0; 1081 - 1082 - free_reset: 1083 - devm_gpiod_put(&bg->sd->dev, bg->rst_gpio); 1084 - bg->rst_gpio = NULL; 1085 - free_boot: 1086 - devm_gpiod_put(&bg->sd->dev, bg->bootloader_backdoor_gpio); 1087 - bg->bootloader_backdoor_gpio = NULL; 1088 - return ret; 1089 1074 } 1090 1075 1091 1076 static void gb_fw_deinit(struct gb_beagleplay *bg)