Skip to content

Commit b11f75d

Browse files
committed
mfd: ab8500: no need to check return value of debugfs_create functions
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Lee Jones <lee.jones@linaro.org> Cc: linux-arm-kernel@lists.infradead.org Link: https://lore.kernel.org/r/20190706164722.18766-2-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 45640a3 commit b11f75d

1 file changed

Lines changed: 98 additions & 226 deletions

File tree

‎drivers/mfd/ab8500-debugfs.c‎

Lines changed: 98 additions & 226 deletions
Original file line numberDiff line numberDiff line change
@@ -2644,12 +2644,10 @@ static const struct file_operations ab8500_hwreg_fops = {
26442644
.owner = THIS_MODULE,
26452645
};
26462646

2647-
static struct dentry *ab8500_dir;
2648-
static struct dentry *ab8500_gpadc_dir;
2649-
26502647
static int ab8500_debug_probe(struct platform_device *plf)
26512648
{
2652-
struct dentry *file;
2649+
struct dentry *ab8500_dir;
2650+
struct dentry *ab8500_gpadc_dir;
26532651
struct ab8500 *ab8500;
26542652
struct resource *res;
26552653

@@ -2694,47 +2692,22 @@ static int ab8500_debug_probe(struct platform_device *plf)
26942692
}
26952693

26962694
ab8500_dir = debugfs_create_dir(AB8500_NAME_STRING, NULL);
2697-
if (!ab8500_dir)
2698-
goto err;
26992695

27002696
ab8500_gpadc_dir = debugfs_create_dir(AB8500_ADC_NAME_STRING,
27012697
ab8500_dir);
2702-
if (!ab8500_gpadc_dir)
2703-
goto err;
2704-
2705-
file = debugfs_create_file("all-bank-registers", S_IRUGO, ab8500_dir,
2706-
&plf->dev, &ab8500_bank_registers_fops);
2707-
if (!file)
2708-
goto err;
2709-
2710-
file = debugfs_create_file("all-banks", S_IRUGO, ab8500_dir,
2711-
&plf->dev, &ab8500_all_banks_fops);
2712-
if (!file)
2713-
goto err;
2714-
2715-
file = debugfs_create_file("register-bank",
2716-
(S_IRUGO | S_IWUSR | S_IWGRP),
2717-
ab8500_dir, &plf->dev, &ab8500_bank_fops);
2718-
if (!file)
2719-
goto err;
2720-
2721-
file = debugfs_create_file("register-address",
2722-
(S_IRUGO | S_IWUSR | S_IWGRP),
2723-
ab8500_dir, &plf->dev, &ab8500_address_fops);
2724-
if (!file)
2725-
goto err;
2726-
2727-
file = debugfs_create_file("register-value",
2728-
(S_IRUGO | S_IWUSR | S_IWGRP),
2729-
ab8500_dir, &plf->dev, &ab8500_val_fops);
2730-
if (!file)
2731-
goto err;
2732-
2733-
file = debugfs_create_file("irq-subscribe",
2734-
(S_IRUGO | S_IWUSR | S_IWGRP), ab8500_dir,
2735-
&plf->dev, &ab8500_subscribe_fops);
2736-
if (!file)
2737-
goto err;
2698+
2699+
debugfs_create_file("all-bank-registers", S_IRUGO, ab8500_dir,
2700+
&plf->dev, &ab8500_bank_registers_fops);
2701+
debugfs_create_file("all-banks", S_IRUGO, ab8500_dir,
2702+
&plf->dev, &ab8500_all_banks_fops);
2703+
debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP),
2704+
ab8500_dir, &plf->dev, &ab8500_bank_fops);
2705+
debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP),
2706+
ab8500_dir, &plf->dev, &ab8500_address_fops);
2707+
debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP),
2708+
ab8500_dir, &plf->dev, &ab8500_val_fops);
2709+
debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
2710+
ab8500_dir, &plf->dev, &ab8500_subscribe_fops);
27382711

27392712
if (is_ab8500(ab8500)) {
27402713
debug_ranges = ab8500_debug_ranges;
@@ -2750,194 +2723,93 @@ static int ab8500_debug_probe(struct platform_device *plf)
27502723
num_interrupt_lines = AB8540_NR_IRQS;
27512724
}
27522725

2753-
file = debugfs_create_file("interrupts", (S_IRUGO), ab8500_dir,
2754-
&plf->dev, &ab8500_interrupts_fops);
2755-
if (!file)
2756-
goto err;
2757-
2758-
file = debugfs_create_file("irq-unsubscribe",
2759-
(S_IRUGO | S_IWUSR | S_IWGRP), ab8500_dir,
2760-
&plf->dev, &ab8500_unsubscribe_fops);
2761-
if (!file)
2762-
goto err;
2763-
2764-
file = debugfs_create_file("hwreg", (S_IRUGO | S_IWUSR | S_IWGRP),
2765-
ab8500_dir, &plf->dev, &ab8500_hwreg_fops);
2766-
if (!file)
2767-
goto err;
2768-
2769-
file = debugfs_create_file("all-modem-registers",
2770-
(S_IRUGO | S_IWUSR | S_IWGRP),
2771-
ab8500_dir, &plf->dev, &ab8500_modem_fops);
2772-
if (!file)
2773-
goto err;
2774-
2775-
file = debugfs_create_file("bat_ctrl", (S_IRUGO | S_IWUSR | S_IWGRP),
2776-
ab8500_gpadc_dir, &plf->dev,
2777-
&ab8500_gpadc_bat_ctrl_fops);
2778-
if (!file)
2779-
goto err;
2780-
2781-
file = debugfs_create_file("btemp_ball", (S_IRUGO | S_IWUSR | S_IWGRP),
2782-
ab8500_gpadc_dir,
2783-
&plf->dev, &ab8500_gpadc_btemp_ball_fops);
2784-
if (!file)
2785-
goto err;
2786-
2787-
file = debugfs_create_file("main_charger_v",
2788-
(S_IRUGO | S_IWUSR | S_IWGRP),
2789-
ab8500_gpadc_dir, &plf->dev,
2790-
&ab8500_gpadc_main_charger_v_fops);
2791-
if (!file)
2792-
goto err;
2793-
2794-
file = debugfs_create_file("acc_detect1",
2795-
(S_IRUGO | S_IWUSR | S_IWGRP),
2796-
ab8500_gpadc_dir, &plf->dev,
2797-
&ab8500_gpadc_acc_detect1_fops);
2798-
if (!file)
2799-
goto err;
2800-
2801-
file = debugfs_create_file("acc_detect2",
2802-
(S_IRUGO | S_IWUSR | S_IWGRP),
2803-
ab8500_gpadc_dir, &plf->dev,
2804-
&ab8500_gpadc_acc_detect2_fops);
2805-
if (!file)
2806-
goto err;
2807-
2808-
file = debugfs_create_file("adc_aux1", (S_IRUGO | S_IWUSR | S_IWGRP),
2809-
ab8500_gpadc_dir, &plf->dev,
2810-
&ab8500_gpadc_aux1_fops);
2811-
if (!file)
2812-
goto err;
2813-
2814-
file = debugfs_create_file("adc_aux2", (S_IRUGO | S_IWUSR | S_IWGRP),
2815-
ab8500_gpadc_dir, &plf->dev,
2816-
&ab8500_gpadc_aux2_fops);
2817-
if (!file)
2818-
goto err;
2819-
2820-
file = debugfs_create_file("main_bat_v", (S_IRUGO | S_IWUSR | S_IWGRP),
2821-
ab8500_gpadc_dir, &plf->dev,
2822-
&ab8500_gpadc_main_bat_v_fops);
2823-
if (!file)
2824-
goto err;
2825-
2826-
file = debugfs_create_file("vbus_v", (S_IRUGO | S_IWUSR | S_IWGRP),
2827-
ab8500_gpadc_dir, &plf->dev,
2828-
&ab8500_gpadc_vbus_v_fops);
2829-
if (!file)
2830-
goto err;
2831-
2832-
file = debugfs_create_file("main_charger_c",
2833-
(S_IRUGO | S_IWUSR | S_IWGRP),
2834-
ab8500_gpadc_dir, &plf->dev,
2835-
&ab8500_gpadc_main_charger_c_fops);
2836-
if (!file)
2837-
goto err;
2838-
2839-
file = debugfs_create_file("usb_charger_c",
2840-
(S_IRUGO | S_IWUSR | S_IWGRP),
2841-
ab8500_gpadc_dir,
2842-
&plf->dev, &ab8500_gpadc_usb_charger_c_fops);
2843-
if (!file)
2844-
goto err;
2845-
2846-
file = debugfs_create_file("bk_bat_v", (S_IRUGO | S_IWUSR | S_IWGRP),
2847-
ab8500_gpadc_dir, &plf->dev,
2848-
&ab8500_gpadc_bk_bat_v_fops);
2849-
if (!file)
2850-
goto err;
2851-
2852-
file = debugfs_create_file("die_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
2853-
ab8500_gpadc_dir, &plf->dev,
2854-
&ab8500_gpadc_die_temp_fops);
2855-
if (!file)
2856-
goto err;
2857-
2858-
file = debugfs_create_file("usb_id", (S_IRUGO | S_IWUSR | S_IWGRP),
2859-
ab8500_gpadc_dir, &plf->dev,
2860-
&ab8500_gpadc_usb_id_fops);
2861-
if (!file)
2862-
goto err;
2863-
2726+
debugfs_create_file("interrupts", (S_IRUGO), ab8500_dir, &plf->dev,
2727+
&ab8500_interrupts_fops);
2728+
debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
2729+
ab8500_dir, &plf->dev, &ab8500_unsubscribe_fops);
2730+
debugfs_create_file("hwreg", (S_IRUGO | S_IWUSR | S_IWGRP), ab8500_dir,
2731+
&plf->dev, &ab8500_hwreg_fops);
2732+
debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP),
2733+
ab8500_dir, &plf->dev, &ab8500_modem_fops);
2734+
debugfs_create_file("bat_ctrl", (S_IRUGO | S_IWUSR | S_IWGRP),
2735+
ab8500_gpadc_dir, &plf->dev,
2736+
&ab8500_gpadc_bat_ctrl_fops);
2737+
debugfs_create_file("btemp_ball", (S_IRUGO | S_IWUSR | S_IWGRP),
2738+
ab8500_gpadc_dir, &plf->dev,
2739+
&ab8500_gpadc_btemp_ball_fops);
2740+
debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP),
2741+
ab8500_gpadc_dir, &plf->dev,
2742+
&ab8500_gpadc_main_charger_v_fops);
2743+
debugfs_create_file("acc_detect1", (S_IRUGO | S_IWUSR | S_IWGRP),
2744+
ab8500_gpadc_dir, &plf->dev,
2745+
&ab8500_gpadc_acc_detect1_fops);
2746+
debugfs_create_file("acc_detect2", (S_IRUGO | S_IWUSR | S_IWGRP),
2747+
ab8500_gpadc_dir, &plf->dev,
2748+
&ab8500_gpadc_acc_detect2_fops);
2749+
debugfs_create_file("adc_aux1", (S_IRUGO | S_IWUSR | S_IWGRP),
2750+
ab8500_gpadc_dir, &plf->dev,
2751+
&ab8500_gpadc_aux1_fops);
2752+
debugfs_create_file("adc_aux2", (S_IRUGO | S_IWUSR | S_IWGRP),
2753+
ab8500_gpadc_dir, &plf->dev,
2754+
&ab8500_gpadc_aux2_fops);
2755+
debugfs_create_file("main_bat_v", (S_IRUGO | S_IWUSR | S_IWGRP),
2756+
ab8500_gpadc_dir, &plf->dev,
2757+
&ab8500_gpadc_main_bat_v_fops);
2758+
debugfs_create_file("vbus_v", (S_IRUGO | S_IWUSR | S_IWGRP),
2759+
ab8500_gpadc_dir, &plf->dev,
2760+
&ab8500_gpadc_vbus_v_fops);
2761+
debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
2762+
ab8500_gpadc_dir, &plf->dev,
2763+
&ab8500_gpadc_main_charger_c_fops);
2764+
debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
2765+
ab8500_gpadc_dir, &plf->dev,
2766+
&ab8500_gpadc_usb_charger_c_fops);
2767+
debugfs_create_file("bk_bat_v", (S_IRUGO | S_IWUSR | S_IWGRP),
2768+
ab8500_gpadc_dir, &plf->dev,
2769+
&ab8500_gpadc_bk_bat_v_fops);
2770+
debugfs_create_file("die_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
2771+
ab8500_gpadc_dir, &plf->dev,
2772+
&ab8500_gpadc_die_temp_fops);
2773+
debugfs_create_file("usb_id", (S_IRUGO | S_IWUSR | S_IWGRP),
2774+
ab8500_gpadc_dir, &plf->dev,
2775+
&ab8500_gpadc_usb_id_fops);
28642776
if (is_ab8540(ab8500)) {
2865-
file = debugfs_create_file("xtal_temp",
2866-
(S_IRUGO | S_IWUSR | S_IWGRP),
2867-
ab8500_gpadc_dir, &plf->dev,
2868-
&ab8540_gpadc_xtal_temp_fops);
2869-
if (!file)
2870-
goto err;
2871-
file = debugfs_create_file("vbattruemeas",
2872-
(S_IRUGO | S_IWUSR | S_IWGRP),
2873-
ab8500_gpadc_dir, &plf->dev,
2874-
&ab8540_gpadc_vbat_true_meas_fops);
2875-
if (!file)
2876-
goto err;
2877-
file = debugfs_create_file("batctrl_and_ibat",
2878-
(S_IRUGO | S_IWUGO),
2879-
ab8500_gpadc_dir,
2880-
&plf->dev,
2881-
&ab8540_gpadc_bat_ctrl_and_ibat_fops);
2882-
if (!file)
2883-
goto err;
2884-
file = debugfs_create_file("vbatmeas_and_ibat",
2885-
(S_IRUGO | S_IWUGO),
2886-
ab8500_gpadc_dir, &plf->dev,
2887-
&ab8540_gpadc_vbat_meas_and_ibat_fops);
2888-
if (!file)
2889-
goto err;
2890-
file = debugfs_create_file("vbattruemeas_and_ibat",
2891-
(S_IRUGO | S_IWUGO),
2892-
ab8500_gpadc_dir,
2893-
&plf->dev,
2894-
&ab8540_gpadc_vbat_true_meas_and_ibat_fops);
2895-
if (!file)
2896-
goto err;
2897-
file = debugfs_create_file("battemp_and_ibat",
2898-
(S_IRUGO | S_IWUGO),
2899-
ab8500_gpadc_dir,
2900-
&plf->dev, &ab8540_gpadc_bat_temp_and_ibat_fops);
2901-
if (!file)
2902-
goto err;
2903-
file = debugfs_create_file("otp_calib",
2904-
(S_IRUGO | S_IWUSR | S_IWGRP),
2905-
ab8500_gpadc_dir,
2906-
&plf->dev, &ab8540_gpadc_otp_calib_fops);
2907-
if (!file)
2908-
goto err;
2777+
debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
2778+
ab8500_gpadc_dir, &plf->dev,
2779+
&ab8540_gpadc_xtal_temp_fops);
2780+
debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP),
2781+
ab8500_gpadc_dir, &plf->dev,
2782+
&ab8540_gpadc_vbat_true_meas_fops);
2783+
debugfs_create_file("batctrl_and_ibat", (S_IRUGO | S_IWUGO),
2784+
ab8500_gpadc_dir, &plf->dev,
2785+
&ab8540_gpadc_bat_ctrl_and_ibat_fops);
2786+
debugfs_create_file("vbatmeas_and_ibat", (S_IRUGO | S_IWUGO),
2787+
ab8500_gpadc_dir, &plf->dev,
2788+
&ab8540_gpadc_vbat_meas_and_ibat_fops);
2789+
debugfs_create_file("vbattruemeas_and_ibat", (S_IRUGO | S_IWUGO),
2790+
ab8500_gpadc_dir, &plf->dev,
2791+
&ab8540_gpadc_vbat_true_meas_and_ibat_fops);
2792+
debugfs_create_file("battemp_and_ibat", (S_IRUGO | S_IWUGO),
2793+
ab8500_gpadc_dir, &plf->dev,
2794+
&ab8540_gpadc_bat_temp_and_ibat_fops);
2795+
debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP),
2796+
ab8500_gpadc_dir, &plf->dev,
2797+
&ab8540_gpadc_otp_calib_fops);
29092798
}
2910-
file = debugfs_create_file("avg_sample", (S_IRUGO | S_IWUSR | S_IWGRP),
2911-
ab8500_gpadc_dir, &plf->dev,
2912-
&ab8500_gpadc_avg_sample_fops);
2913-
if (!file)
2914-
goto err;
2915-
2916-
file = debugfs_create_file("trig_edge", (S_IRUGO | S_IWUSR | S_IWGRP),
2917-
ab8500_gpadc_dir, &plf->dev,
2918-
&ab8500_gpadc_trig_edge_fops);
2919-
if (!file)
2920-
goto err;
2921-
2922-
file = debugfs_create_file("trig_timer", (S_IRUGO | S_IWUSR | S_IWGRP),
2923-
ab8500_gpadc_dir, &plf->dev,
2924-
&ab8500_gpadc_trig_timer_fops);
2925-
if (!file)
2926-
goto err;
2927-
2928-
file = debugfs_create_file("conv_type", (S_IRUGO | S_IWUSR | S_IWGRP),
2929-
ab8500_gpadc_dir, &plf->dev,
2930-
&ab8500_gpadc_conv_type_fops);
2931-
if (!file)
2932-
goto err;
2799+
debugfs_create_file("avg_sample", (S_IRUGO | S_IWUSR | S_IWGRP),
2800+
ab8500_gpadc_dir, &plf->dev,
2801+
&ab8500_gpadc_avg_sample_fops);
2802+
debugfs_create_file("trig_edge", (S_IRUGO | S_IWUSR | S_IWGRP),
2803+
ab8500_gpadc_dir, &plf->dev,
2804+
&ab8500_gpadc_trig_edge_fops);
2805+
debugfs_create_file("trig_timer", (S_IRUGO | S_IWUSR | S_IWGRP),
2806+
ab8500_gpadc_dir, &plf->dev,
2807+
&ab8500_gpadc_trig_timer_fops);
2808+
debugfs_create_file("conv_type", (S_IRUGO | S_IWUSR | S_IWGRP),
2809+
ab8500_gpadc_dir, &plf->dev,
2810+
&ab8500_gpadc_conv_type_fops);
29332811

29342812
return 0;
2935-
2936-
err:
2937-
debugfs_remove_recursive(ab8500_dir);
2938-
dev_err(&plf->dev, "failed to create debugfs entries.\n");
2939-
2940-
return -ENOMEM;
29412813
}
29422814

29432815
static struct platform_driver ab8500_debug_driver = {

0 commit comments

Comments
 (0)