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

clk: basic-types: Remove useless allocation failure printks

Printing an error on kmalloc() failures is unnecessary. Remove
the print and use *ptr in sizeof() for future-proof code.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>

+9 -21
+1 -3
drivers/clk/clk-composite.c
··· 200 200 struct clk_ops *clk_composite_ops; 201 201 202 202 composite = kzalloc(sizeof(*composite), GFP_KERNEL); 203 - if (!composite) { 204 - pr_err("%s: could not allocate composite clk\n", __func__); 203 + if (!composite) 205 204 return ERR_PTR(-ENOMEM); 206 - } 207 205 208 206 init.name = name; 209 207 init.flags = flags | CLK_IS_BASIC;
+2 -4
drivers/clk/clk-divider.c
··· 430 430 } 431 431 432 432 /* allocate the divider */ 433 - div = kzalloc(sizeof(struct clk_divider), GFP_KERNEL); 434 - if (!div) { 435 - pr_err("%s: could not allocate divider clk\n", __func__); 433 + div = kzalloc(sizeof(*div), GFP_KERNEL); 434 + if (!div) 436 435 return ERR_PTR(-ENOMEM); 437 - } 438 436 439 437 init.name = name; 440 438 init.ops = &clk_divider_ops;
+1 -3
drivers/clk/clk-fixed-factor.c
··· 74 74 struct clk *clk; 75 75 76 76 fix = kmalloc(sizeof(*fix), GFP_KERNEL); 77 - if (!fix) { 78 - pr_err("%s: could not allocate fixed factor clk\n", __func__); 77 + if (!fix) 79 78 return ERR_PTR(-ENOMEM); 80 - } 81 79 82 80 /* struct clk_fixed_factor assignments */ 83 81 fix->mult = mult;
+2 -4
drivers/clk/clk-fixed-rate.c
··· 65 65 struct clk_init_data init; 66 66 67 67 /* allocate fixed-rate clock */ 68 - fixed = kzalloc(sizeof(struct clk_fixed_rate), GFP_KERNEL); 69 - if (!fixed) { 70 - pr_err("%s: could not allocate fixed clk\n", __func__); 68 + fixed = kzalloc(sizeof(*fixed), GFP_KERNEL); 69 + if (!fixed) 71 70 return ERR_PTR(-ENOMEM); 72 - } 73 71 74 72 init.name = name; 75 73 init.ops = &clk_fixed_rate_ops;
+1 -3
drivers/clk/clk-fractional-divider.c
··· 109 109 struct clk *clk; 110 110 111 111 fd = kzalloc(sizeof(*fd), GFP_KERNEL); 112 - if (!fd) { 113 - dev_err(dev, "could not allocate fractional divider clk\n"); 112 + if (!fd) 114 113 return ERR_PTR(-ENOMEM); 115 - } 116 114 117 115 init.name = name; 118 116 init.ops = &clk_fractional_divider_ops;
+2 -4
drivers/clk/clk-gate.c
··· 135 135 } 136 136 137 137 /* allocate the gate */ 138 - gate = kzalloc(sizeof(struct clk_gate), GFP_KERNEL); 139 - if (!gate) { 140 - pr_err("%s: could not allocate gated clk\n", __func__); 138 + gate = kzalloc(sizeof(*gate), GFP_KERNEL); 139 + if (!gate) 141 140 return ERR_PTR(-ENOMEM); 142 - } 143 141 144 142 init.name = name; 145 143 init.ops = &clk_gate_ops;