From patchwork Fri Jan 12 06:55:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 187585 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp2467dyc; Thu, 11 Jan 2024 22:55:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IFW7xwWFwIl9v4s2PRJ018+CLqO/2NuWa6p8An+Bam9/oqPwTnRGA47+OjbNkcO5CNNUlKv X-Received: by 2002:a05:6a20:1581:b0:19a:7510:2a0c with SMTP id h1-20020a056a20158100b0019a75102a0cmr494118pzj.125.1705042555857; Thu, 11 Jan 2024 22:55:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705042555; cv=none; d=google.com; s=arc-20160816; b=yKOpqYzIvueb63WtnZZU6tE20Ve0yKUqrc5DfJlLjhDR+Qua4EYWZv3q0rA3NPr6m5 PQxhQtqyWloRkTpR9ncKsUd756dc6RQd3gWdxuTvCc1Tv4K5dk/Tv6aBClEoHnqbGXP9 nCLapHwN0B3bPVJe41RNXvGRF5anmsrAZJuRwo5F4CLraqpc/PZzn0ejSNULXdSOPI4L cni0NKpw45sdQfCK9doYK2Lg/h3qwHucAtlDeCV6/MyM4njxAifgvwOsbjOgrmEjq03C kapLZzd2owKf84s88N2DeRP3x+I4BwGlp8jy42sYQ9HIIppD8vehLuMRcn/CISLWe3cG P2GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=63UjO/yImm96QE/+VfB7fa+RlurKaZGr2phbbenRcSU=; fh=KI8kgXE4YlyXOFnhrRYv994I46UDQSKHEB5KEcZwhV0=; b=ZyjiA2tSLDUQeK7+AQXMytVBaOXrKjgV0+/osu2l1xDgDDItanwefVPGlaJ7K+3ZEl /N2ylySuuCZfwmWsRzHZB8xS6bYjOfi5EQRrRovynRT75D4kKGKWZbb2OIuif3swrDpy OoxV3SD195JoLGXmvkNwIpqYXZ7fJAGuwl8/j9ayeQ9Ya7o1updPOJziGzzjN6Hzc6cF c5fYqMHTOxrvZcQd58vYmwou8uhJmbY7lqom+aeHIce7kUr/YtV9f+KFKeFq98AWhpCs siSPNrRGl+od4iIkQG+exM06x676oJPU8J64Xi9NHIICRCj9hINwwPaIXmLeaulEzgB3 ou6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GGlzY+o2; spf=pass (google.com: domain of linux-kernel+bounces-24347-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24347-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id e10-20020a170902744a00b001d3eb45963bsi2513234plt.103.2024.01.11.22.55.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 22:55:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24347-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GGlzY+o2; spf=pass (google.com: domain of linux-kernel+bounces-24347-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24347-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A0F302887A9 for ; Fri, 12 Jan 2024 06:55:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 74C0E5C914; Fri, 12 Jan 2024 06:55:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GGlzY+o2" Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CB9942A87 for ; Fri, 12 Jan 2024 06:55:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-336746c7b6dso5139810f8f.0 for ; Thu, 11 Jan 2024 22:55:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705042529; x=1705647329; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=63UjO/yImm96QE/+VfB7fa+RlurKaZGr2phbbenRcSU=; b=GGlzY+o224Ru9J3u249etAKvOErEhzoWqH0GMAbsYHN8QY906PgEIh2/zmVgyNyAJW zyVDVtEqCwdCoYxwC4yzkKOlmYe9DZQs3Vz5ncT5ZgPh5lGUNmlTJXRJZTx8bf/PS2xu YF5UNHUWocLhF0wWgngvo+ab2xVBUKoeRKD8kiKmzhoVwDChW85loa5352xW2F29x3Bp iJe4ST+CzHyR/hPXkZf7b/eFgoJU7RgMZ9X/roJYZAPFy1RtZMRLQKzYELHKm8sry05J 1HFa+fhcwEjnkijem7cx/aCqYwEs8cZ4bN7BBr2rO7nMMLw4quW4ysGHrZXD1fDAx4Oh 2bCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705042529; x=1705647329; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=63UjO/yImm96QE/+VfB7fa+RlurKaZGr2phbbenRcSU=; b=cBYxivQDd8Ho41DJu/16go5Ixsoaa0zBZ5EsZ6kACzfWBdNJhUX308UG4qdH3xpq91 1Vr5KOiRREU51LP+gGX1zHvCTIzfn4VqWFmmA8zeGp+CYd+MGV5xI4jztk2aar2LSYCX aGBMqO6hiaIMDduLvyKAm1E6RXzm/N40Y8rf/LPVBm+NFY1ohFv4e2V88ObzLvIkCD/0 0HGOfJBApjbLK0/rjaFLWtf2R0r2m6Tp0BHgfKnTXY+jh5BAHU19AhORiqTCOt0QytAZ rgF1Njf2NN3G3VnVywbSVPKchAHdRVtUlCMyCWc1a3qpnYQHFpShQOE7J5tNyfO7mFlQ 93jg== X-Gm-Message-State: AOJu0YxOBcAS5Kkz1UiY7lsKU+KSN0yZr1XgntxWdbWFOB39B9BOVclp 4XBujnhR+VBQKg8ggSKfOIXWV0ZpWjkFAA== X-Received: by 2002:a5d:590f:0:b0:337:7680:8ccf with SMTP id v15-20020a5d590f000000b0033776808ccfmr453616wrd.56.1705042529315; Thu, 11 Jan 2024 22:55:29 -0800 (PST) Received: from localhost ([102.140.209.237]) by smtp.gmail.com with ESMTPSA id d18-20020a5d6452000000b0033761b2de64sm2986699wrw.76.2024.01.11.22.55.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 22:55:28 -0800 (PST) Date: Fri, 12 Jan 2024 09:55:25 +0300 From: Dan Carpenter To: Tzuyi Chang Cc: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] gpio: rtd: Fix signedness bug in probe Message-ID: <46566e85-4afa-4c55-93b2-0d0b71d76b12@moroto.mountain> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787866702942738837 X-GMAIL-MSGID: 1787866702942738837 The "data->irqs[]" array holds unsigned int so this error handling will not work correctly. Fixes: eee636bff0dc ("gpio: rtd: Add support for Realtek DHC(Digital Home Center) RTD SoCs") Signed-off-by: Dan Carpenter Reviewed-by: Linus Walleij --- drivers/gpio/gpio-rtd.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/gpio/gpio-rtd.c b/drivers/gpio/gpio-rtd.c index a7939bd0aa56..bf7f008f58d7 100644 --- a/drivers/gpio/gpio-rtd.c +++ b/drivers/gpio/gpio-rtd.c @@ -525,18 +525,21 @@ static int rtd_gpio_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct gpio_irq_chip *irq_chip; struct rtd_gpio *data; + int ret; data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; - data->irqs[0] = platform_get_irq(pdev, 0); - if (data->irqs[0] < 0) - return data->irqs[0]; + ret = platform_get_irq(pdev, 0); + if (ret < 0) + return ret; + data->irqs[0] = ret; - data->irqs[1] = platform_get_irq(pdev, 1); - if (data->irqs[1] < 0) - return data->irqs[1]; + ret = platform_get_irq(pdev, 1); + if (ret < 0) + return ret; + data->irqs[1] = ret; data->info = device_get_match_data(dev); if (!data->info)