Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934673Ab1ETALl (ORCPT ); Thu, 19 May 2011 20:11:41 -0400 Received: from out2.smtp.messagingengine.com ([66.111.4.26]:44268 "EHLO out2.smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934622Ab1ETALg (ORCPT ); Thu, 19 May 2011 20:11:36 -0400 X-Sasl-enc: uHiuOQaOsGJTy6m9xEUEyzwV+K4T3tDtbk0YaKSrgwbw 1305850295 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Greg Kroah-Hartman Subject: [PATCH 18/44] driver core/platform_device_add_data: set platform_data to NULL if !data Date: Thu, 19 May 2011 17:10:36 -0700 Message-Id: <1305850262-9575-18-git-send-email-gregkh@suse.de> X-Mailer: git-send-email 1.7.4.2 In-Reply-To: <1305850262-9575-1-git-send-email-gregkh@suse.de> References: <20110520000821.GA9367@kroah.com> <1305850262-9575-1-git-send-email-gregkh@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1499 Lines: 54 From: Uwe Kleine-König This makes the data = NULL case more consistent to the data != NULL case. The functional change is that now platform_device_add_data(somepdev, NULL, somesize) sets pdev->dev.platform_data to NULL instead of not touching it. Reviewed-by: Viresh Kumar Signed-off-by: Uwe Kleine-König Signed-off-by: Greg Kroah-Hartman --- drivers/base/platform.c | 17 ++++++++--------- 1 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 9e0e4fc..65cb4c3 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -220,17 +220,16 @@ EXPORT_SYMBOL_GPL(platform_device_add_resources); int platform_device_add_data(struct platform_device *pdev, const void *data, size_t size) { - void *d; + void *d = NULL; - if (!data) - return 0; - - d = kmemdup(data, size, GFP_KERNEL); - if (d) { - pdev->dev.platform_data = d; - return 0; + if (data) { + d = kmemdup(data, size, GFP_KERNEL); + if (!d) + return -ENOMEM; } - return -ENOMEM; + + pdev->dev.platform_data = d; + return 0; } EXPORT_SYMBOL_GPL(platform_device_add_data); -- 1.7.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/