From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-ide@vger.kernel.org,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Tejun Heo <tj@kernel.org>, Viresh Kumar <vireshk@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 3/3] pata_arasan_cf: Move two variable assignments in arasan_cf_probe()
Date: Fri, 16 Feb 2018 17:00:11 +0100 [thread overview]
Message-ID: <0f5492bc-d239-401e-6f77-a27897e4ede5@users.sourceforge.net> (raw)
In-Reply-To: <d492f9d2-ed64-e858-441a-fa554369032c@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 16 Feb 2018 16:42:26 +0100
Move assignments for the local variables "irq_handler" and "pdata"
so that their setting will only be performed after a call
of the function "devm_kzalloc" succeeded by this function.
Thus adjust a corresponding if statement.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/ata/pata_arasan_cf.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c
index ebecab8c3f36..27f241b1b1b1 100644
--- a/drivers/ata/pata_arasan_cf.c
+++ b/drivers/ata/pata_arasan_cf.c
@@ -790,12 +790,12 @@ static struct ata_port_operations arasan_cf_ops = {
static int arasan_cf_probe(struct platform_device *pdev)
{
struct arasan_cf_dev *acdev;
- struct arasan_cf_pdata *pdata = dev_get_platdata(&pdev->dev);
+ struct arasan_cf_pdata *pdata;
struct ata_host *host;
struct ata_port *ap;
struct resource *res;
u32 quirk;
- irq_handler_t irq_handler = NULL;
+ irq_handler_t irq_handler;
int ret;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -812,6 +812,7 @@ static int arasan_cf_probe(struct platform_device *pdev)
if (!acdev)
return -ENOMEM;
+ pdata = dev_get_platdata(&pdev->dev);
if (pdata)
quirk = pdata->quirk;
else
@@ -819,10 +820,12 @@ static int arasan_cf_probe(struct platform_device *pdev)
/* if irq is 0, support only PIO */
acdev->irq = platform_get_irq(pdev, 0);
- if (acdev->irq)
+ if (acdev->irq) {
irq_handler = arasan_cf_interrupt;
- else
+ } else {
quirk |= CF_BROKEN_MWDMA | CF_BROKEN_UDMA;
+ irq_handler = NULL;
+ }
acdev->pbase = res->start;
acdev->vbase = devm_ioremap_nocache(&pdev->dev, res->start,
--
2.16.1
prev parent reply other threads:[~2018-02-16 16:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-16 15:56 [PATCH 0/3] PATA-Arasan CF: Adjustments for arasan_cf_probe() SF Markus Elfring
2018-02-16 15:57 ` [PATCH 1/3] pata_arasan_cf: Delete an error message for a failed memory allocation in arasan_cf_probe() SF Markus Elfring
2018-02-16 15:59 ` [PATCH 2/3] pata_arasan_cf: Delete an unnecessary variable initialisation " SF Markus Elfring
2018-02-16 16:00 ` SF Markus Elfring [this message]
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=0f5492bc-d239-401e-6f77-a27897e4ede5@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=b.zolnierkie@samsung.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
--cc=vireshk@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).