All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Baldyga <r.baldyga@samsung.com>
To: unlisted-recipients:; (no To-header on input)
Cc: robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com,
	ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
	rob@landley.net, myungjoo.ham@samsung.com, cw00.choi@samsung.com,
	dbaryshkov@gmail.com, dwmw2@infradead.org, balbi@ti.com,
	gregkh@linuxfoundation.org, grant.likely@linaro.org,
	ldewangan@nvidia.com, kishon@ti.com, gg@slimlogic.co.uk,
	anton@enomsg.org, jonghwa3.lee@samsung.com, rongjun.ying@csr.com,
	linux@roeck-us.net, aaro.koskinen@iki.fi, tony@atomide.com,
	devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	patches@opensource.wolfsonmicro.com, linux-usb@vger.kernel.org,
	linux-omap@vger.kernel.org,
	Robert Baldyga <r.baldyga@samsung.com>
Subject: [PATCH 13/13] extcon: extcon-max77693: check if pdata exists
Date: Thu, 10 Apr 2014 15:16:51 +0200	[thread overview]
Message-ID: <1397135811-12866-14-git-send-email-r.baldyga@samsung.com> (raw)
In-Reply-To: <1397135811-12866-1-git-send-email-r.baldyga@samsung.com>

This patch adds check if pdata is NULL, to avoid NULL pointer dereference
when platform data is not available. After this changes, in described
situation driver will be configured with default values.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
---
 drivers/extcon/extcon-max77693.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index 2cd8892..fa8534e 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -1210,7 +1210,7 @@ static int max77693_muic_probe(struct platform_device *pdev)
 
 
 	/* Initialize MUIC register by using platform data or default data */
-	if (pdata->muic_data) {
+	if (pdata && pdata->muic_data) {
 		init_data = pdata->muic_data->init_data;
 		num_init_data = pdata->muic_data->num_init_data;
 	} else {
-- 
1.7.9.5


WARNING: multiple messages have this Message-ID (diff)
From: Robert Baldyga <r.baldyga@samsung.com>
Cc: robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com,
	ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
	rob@landley.net, myungjoo.ham@samsung.com, cw00.choi@samsung.com,
	dbaryshkov@gmail.com, dwmw2@infradead.org, balbi@ti.com,
	gregkh@linuxfoundation.org, grant.likely@linaro.org,
	ldewangan@nvidia.com, kishon@ti.com, gg@slimlogic.co.uk,
	anton@enomsg.org, jonghwa3.lee@samsung.com, rongjun.ying@csr.com,
	linux@roeck-us.net, aaro.koskinen@iki.fi, tony@atomide.com,
	devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	patches@opensource.wolfsonmicro.com, linux-usb@vger.kernel.org,
	linux-omap@vger.kernel.org,
	Robert Baldyga <r.baldyga@samsung.com>
Subject: [PATCH 13/13] extcon: extcon-max77693: check if pdata exists
Date: Thu, 10 Apr 2014 15:16:51 +0200	[thread overview]
Message-ID: <1397135811-12866-14-git-send-email-r.baldyga@samsung.com> (raw)
In-Reply-To: <1397135811-12866-1-git-send-email-r.baldyga@samsung.com>

This patch adds check if pdata is NULL, to avoid NULL pointer dereference
when platform data is not available. After this changes, in described
situation driver will be configured with default values.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
---
 drivers/extcon/extcon-max77693.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index 2cd8892..fa8534e 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -1210,7 +1210,7 @@ static int max77693_muic_probe(struct platform_device *pdev)
 
 
 	/* Initialize MUIC register by using platform data or default data */
-	if (pdata->muic_data) {
+	if (pdata && pdata->muic_data) {
 		init_data = pdata->muic_data->init_data;
 		num_init_data = pdata->muic_data->num_init_data;
 	} else {
-- 
1.7.9.5


  parent reply	other threads:[~2014-04-10 13:21 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-10 13:16 [PATCH 00/13] extcon: major rework Robert Baldyga
2014-04-10 13:16 ` Robert Baldyga
2014-04-10 13:16 ` [PATCH 01/13] Documentation: add extcon devicetree bindings Robert Baldyga
2014-04-10 13:16   ` Robert Baldyga
2014-04-10 13:16 ` [PATCH 02/13] Documentation: update charger-manager " Robert Baldyga
2014-04-10 13:16   ` Robert Baldyga
2014-04-10 13:16 ` [PATCH 03/13] extcon: extcon-class: remove extcon_set_cable_state() function Robert Baldyga
2014-04-10 13:16   ` Robert Baldyga
2014-04-10 13:16 ` [PATCH 04/13] extcon: extcon-class: match extcon device by devicetree node Robert Baldyga
2014-04-10 13:16   ` Robert Baldyga
2014-04-10 13:16 ` [PATCH 05/13] extcon: extcon-class: improve extcon client API Robert Baldyga
2014-04-10 13:16   ` Robert Baldyga
2014-04-10 18:09   ` Aaro Koskinen
2014-04-10 18:09     ` Aaro Koskinen
2014-04-10 13:16 ` [PATCH 06/13] extcon: extcon-class: remove unused functions Robert Baldyga
2014-04-10 13:16   ` Robert Baldyga
2014-04-10 13:16 ` [PATCH 07/13] extcon: extcon-class: improve get_cable_state_()/set_cable_state_() functions Robert Baldyga
2014-04-10 13:16   ` Robert Baldyga
2014-04-10 13:16 ` [PATCH 08/13] extcon: extcon-class: simplify extcon_updata_state() function Robert Baldyga
2014-04-10 13:16   ` Robert Baldyga
2014-04-10 13:16 ` [PATCH 09/13] extcon: extcon-class: move example to Documentation Robert Baldyga
2014-04-10 13:16   ` Robert Baldyga
2014-04-10 13:16 ` [PATCH 10/13] extcon: extcon-gpio: add devicetree support Robert Baldyga
2014-04-10 13:16   ` Robert Baldyga
2014-04-10 13:16 ` [PATCH 11/13] extcon: extcon-adc-jack: " Robert Baldyga
2014-04-10 13:16   ` Robert Baldyga
2014-04-10 13:16 ` [PATCH 12/13] extcon: extcon-max8997: check if pdata exists Robert Baldyga
2014-04-10 13:16   ` Robert Baldyga
2014-04-10 13:16 ` Robert Baldyga [this message]
2014-04-10 13:16   ` [PATCH 13/13] extcon: extcon-max77693: " Robert Baldyga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1397135811-12866-14-git-send-email-r.baldyga@samsung.com \
    --to=r.baldyga@samsung.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=anton@enomsg.org \
    --cc=balbi@ti.com \
    --cc=cw00.choi@samsung.com \
    --cc=dbaryshkov@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=galak@codeaurora.org \
    --cc=gg@slimlogic.co.uk \
    --cc=grant.likely@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=jonghwa3.lee@samsung.com \
    --cc=kishon@ti.com \
    --cc=ldewangan@nvidia.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mark.rutland@arm.com \
    --cc=myungjoo.ham@samsung.com \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=pawel.moll@arm.com \
    --cc=rob@landley.net \
    --cc=robh+dt@kernel.org \
    --cc=rongjun.ying@csr.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.