Received: by 10.223.164.202 with SMTP id h10csp1156150wrb; Fri, 17 Nov 2017 15:04:31 -0800 (PST) X-Google-Smtp-Source: AGs4zMbhj0VXK7QK82894worotxWBSvh/ROmdriNTXVM4DzCTD77aJ20NL3Hb5Q3lROhZrxXVXdy X-Received: by 10.98.160.70 with SMTP id r67mr3578415pfe.153.1510959871414; Fri, 17 Nov 2017 15:04:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510959871; cv=none; d=google.com; s=arc-20160816; b=cieSj2V9ZCVMgwpnRamEnfaUy/1HmKDMGHysJz4yHUlfI8ygZWRg51ns9ix1IyDQVe /8fHiLDTWq5wEdJj68LHFCTpkkyHdemArbkFyP8ms/6qbKF65BrRTQ3DZIaZhrBaNuOe 6+156M7LVKZY4U/9tv/OjzujPQMRGNy5Came+dncsjQ72uCZp8J8MhwkMi7DnTyq9NYc fiG1CSTCB1/mZx8xaWErJRRmp/Dyi0TuTMd82bYg3Qjxd1XWaQWGGZl7b4MGBUY0QN7d JddeByp3cyem3rftHcjNhe3P+tNnXnOK3Xj+hmA2akwU9yT2BJd+46QPYEHZnKTjqecw 9zlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=/hQwn8mnG4BZ/LcypDSANdhD1iTQjiecJhRWWFmMLWk=; b=kUX4GXrhvj5kQr9+IjWcSeHHWgkaNwSF7hCgvIES4qv+6pcKlUZOsWbMX3dLtO4Noo w/Mfh7UBHPbaS9DMrIP82B7oVfWYjTNWq2TagJ0EN1WwTQc5hVrCKmUJKgCJCWH/vGHN qv/9gFUVBlf8L9qwwNHMoi7uHdFYTwykv3gnkOWbH/DZCW4PllHWSN9da/oKYAvFWNA9 wG4o+hU4HVubDST1vRhSEEBqmGQ25d49Em2avpZRQHUumJL7aXFcnPRpT/TlVV68dVTT Tj7NQ2H0mehaWry4akfPAxZ0pk2fHGaUwrGzo9Qkupw5C5uF43y8V7mz81sGNofhboId JMfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YAXfrMj0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1si3435713pgq.39.2017.11.17.15.04.18; Fri, 17 Nov 2017 15:04:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YAXfrMj0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965310AbdKQQVz (ORCPT + 93 others); Fri, 17 Nov 2017 11:21:55 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:40735 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751322AbdKQQVt (ORCPT ); Fri, 17 Nov 2017 11:21:49 -0500 Received: by mail-pf0-f196.google.com with SMTP id u70so2271990pfa.7 for ; Fri, 17 Nov 2017 08:21:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=/hQwn8mnG4BZ/LcypDSANdhD1iTQjiecJhRWWFmMLWk=; b=YAXfrMj0aFGonKzbVpfhGXaBBUWYUYCun+pqlg0YK2RpUwPFExtiaDdaI6MgQZMDkh Q6BMMjIMzwaJ3nMHdcDiC52vZiZD5dlpgpMJBi4FqY3kITRJzL/zt8GfgYjB4FzI5600 pjgox4sdGO64b37v+e5vFt/KV8NAzqDJCg0pwFgWnXxItBbL3ofSUvpMlEY7t1w8a27D Hl2lctOB5P5a+//sTVWMmumt09iVlc8i+y0uvCWmCcz87pUD/sQU5PK+634bEGwKnL/L 0g76O7EYm8s8Z8YsJR0oTav4gl6NOLbvoqyHQMpe4zZX6y/YoNvHm6baExnzmr3BzPUf b+bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/hQwn8mnG4BZ/LcypDSANdhD1iTQjiecJhRWWFmMLWk=; b=Zd75YIry+bbwu4ew0Fjr0i8z5qqQkjO4z3/n72VxzTOUgaA0j7OwMirLa2JLPIoz3c taTlkn1S1yFiUdlsRGZcifZBRFcKSwELJ+y9Gkl0ebDcPbToxof83xXskUR4dyX+hNuV yAfk6nnTPepVLTUfmD+UAFpPYgy9Kcp0xpWCmAQPWTOVdFRhAmCyvzWKjY6ksh3vVqg0 ZWuXFUQVj6lYZstAs9pK0BIPRGCzaWIiGafgnffQBb2+OAZtR/TrnxJnoJIOimRQsSYn KjDSFKt6Muk9A0z5Xnt8u2NSntW6EA2z7D02EiB/f9e6X2deZT/+fkB3A9IXXdldfYTW Cv9Q== X-Gm-Message-State: AJaThX4LLBKLDsZGkb2jaLCgo6PLpF/iwB6O1Fnvyc2vgGMWz8mQtc26 nfzJbiUMNIMbKuKH7K+tQFc= X-Received: by 10.98.0.5 with SMTP id 5mr2642016pfa.34.1510935709159; Fri, 17 Nov 2017 08:21:49 -0800 (PST) Received: from localhost.localdomain ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id q16sm7326580pgq.79.2017.11.17.08.21.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Nov 2017 08:21:48 -0800 (PST) From: Arvind Yadav To: f.fainelli@gmail.com Cc: linux-kernel@vger.kernel.org Subject: [PATCH] vlynq : Handle return value of platform_get_irq_byname and vlynq_probe Date: Fri, 17 Nov 2017 21:51:22 +0530 Message-Id: <1d87b593fd57869ad42701df6c3087efa9e74c94.1510935630.git.arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org platform_get_irq_byname() can fail here and we must check its return value. device_register() can fail here, initialised 'result' variable beforen'goto fail_register' otherwise vlynq_probe will return uninitialised 'result' variable. Signed-off-by: Arvind Yadav --- drivers/vlynq/vlynq.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/vlynq/vlynq.c b/drivers/vlynq/vlynq.c index c0227f9..bc735f9 100644 --- a/drivers/vlynq/vlynq.c +++ b/drivers/vlynq/vlynq.c @@ -722,13 +722,19 @@ static int vlynq_probe(struct platform_device *pdev) VLYNQ_REMOTE_OFFSET); dev->irq = platform_get_irq_byname(pdev, "irq"); + if (dev->irq < 0) { + result = dev->irq; + goto fail_register; + } dev->irq_start = irq_res->start; dev->irq_end = irq_res->end; dev->local_irq = dev->irq_end - dev->irq_start; dev->remote_irq = dev->local_irq - 1; - if (device_register(&dev->dev)) + if (device_register(&dev->dev)) { + result = -ENXIO; goto fail_register; + } platform_set_drvdata(pdev, dev); printk(KERN_INFO "%s: regs 0x%p, irq %d, mem 0x%p\n", -- 2.7.4 From 1584347422396588413@xxx Fri Nov 17 20:44:05 +0000 2017 X-GM-THRID: 1584347422396588413 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread