diff options
Diffstat (limited to 'drivers/base/platform.c')
-rw-r--r-- | drivers/base/platform.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index a01abf9ebf7b..c794fec1c435 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -192,6 +192,9 @@ int platform_device_add_resources(struct platform_device *pdev, | |||
192 | { | 192 | { |
193 | struct resource *r; | 193 | struct resource *r; |
194 | 194 | ||
195 | if (!res) | ||
196 | return 0; | ||
197 | |||
195 | r = kmemdup(res, sizeof(struct resource) * num, GFP_KERNEL); | 198 | r = kmemdup(res, sizeof(struct resource) * num, GFP_KERNEL); |
196 | if (r) { | 199 | if (r) { |
197 | pdev->resource = r; | 200 | pdev->resource = r; |
@@ -215,8 +218,12 @@ EXPORT_SYMBOL_GPL(platform_device_add_resources); | |||
215 | int platform_device_add_data(struct platform_device *pdev, const void *data, | 218 | int platform_device_add_data(struct platform_device *pdev, const void *data, |
216 | size_t size) | 219 | size_t size) |
217 | { | 220 | { |
218 | void *d = kmemdup(data, size, GFP_KERNEL); | 221 | void *d; |
222 | |||
223 | if (!data) | ||
224 | return 0; | ||
219 | 225 | ||
226 | d = kmemdup(data, size, GFP_KERNEL); | ||
220 | if (d) { | 227 | if (d) { |
221 | pdev->dev.platform_data = d; | 228 | pdev->dev.platform_data = d; |
222 | return 0; | 229 | return 0; |