Commit 5827fe59 authored by Rosen Penev's avatar Rosen Penev Committed by Alexandre Belloni
Browse files

rtc: armada38x: zalloc + calloc to single allocation

parent 5ff89ef4
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -72,8 +72,8 @@ struct armada38x_rtc {
	spinlock_t	    lock;
	int		    irq;
	bool		    initialized;
	struct value_to_freq *val_to_freq;
	const struct armada38x_rtc_data *data;
	struct value_to_freq val_to_freq[];
};

#define ALARM1	0
@@ -490,18 +490,13 @@ static __init int armada38x_rtc_probe(struct platform_device *pdev)
{
	struct armada38x_rtc *rtc;

	rtc = devm_kzalloc(&pdev->dev, sizeof(struct armada38x_rtc),
	rtc = devm_kzalloc(&pdev->dev, struct_size(rtc, val_to_freq, SAMPLE_NR),
			    GFP_KERNEL);
	if (!rtc)
		return -ENOMEM;

	rtc->data = of_device_get_match_data(&pdev->dev);

	rtc->val_to_freq = devm_kcalloc(&pdev->dev, SAMPLE_NR,
				sizeof(struct value_to_freq), GFP_KERNEL);
	if (!rtc->val_to_freq)
		return -ENOMEM;

	spin_lock_init(&rtc->lock);

	rtc->regs = devm_platform_ioremap_resource_byname(pdev, "rtc");