| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright 2015 Chen-Yu Tsai |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Chen-Yu Tsai <wens@csie.org> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | | - * (at your option) any later version. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | | - * GNU General Public License for more details. |
|---|
| 15 | 6 | */ |
|---|
| 16 | 7 | |
|---|
| 17 | 8 | #include <linux/clk.h> |
|---|
| 18 | 9 | #include <linux/clk-provider.h> |
|---|
| 19 | 10 | #include <linux/delay.h> |
|---|
| 20 | 11 | #include <linux/init.h> |
|---|
| 12 | +#include <linux/io.h> |
|---|
| 21 | 13 | #include <linux/of.h> |
|---|
| 22 | 14 | #include <linux/of_device.h> |
|---|
| 23 | 15 | #include <linux/reset.h> |
|---|
| .. | .. |
|---|
| 117 | 109 | spin_lock_init(&data->lock); |
|---|
| 118 | 110 | |
|---|
| 119 | 111 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
|---|
| 112 | + if (!r) |
|---|
| 113 | + return -EINVAL; |
|---|
| 120 | 114 | /* one clock/reset pair per word */ |
|---|
| 121 | 115 | count = DIV_ROUND_UP((resource_size(r)), SUN9I_MMC_WIDTH); |
|---|
| 122 | 116 | data->membase = devm_ioremap_resource(&pdev->dev, r); |
|---|