Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2121914rdd; Thu, 11 Jan 2024 22:57:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IER/sy0qbxT7oxHOX8fz9yUpm5qHfUyKFCVs3kkvsiSC+dIDtAWZdamDy4WxoyDKYA9KcfD X-Received: by 2002:a05:6a20:9284:b0:19a:3a02:26d with SMTP id q4-20020a056a20928400b0019a3a02026dmr373282pzg.8.1705042662254; Thu, 11 Jan 2024 22:57:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705042662; cv=none; d=google.com; s=arc-20160816; b=gn2mFRaGhWVI3tK5QfqBHu5Oe6QcRkQBWQTWJis0fiGnS4UcVRctb1mX1u/GKwqOZ+ fG0CEkfc8nFZNtDeZZ3+1+OfDU/QAKq8TE1F/2vt5c7gY9/Zh40O0f78ftX0ebkulGrr Dg0qlfGTvzlrwlMGWyP5HsuTyTUfeGSkp1neNn/UtC7OWfTtcR6XJAEY2pzIxNwzSp/H ogX0vzVgfD5c2GY8qlA329OFZ6ariKuMMv821qpej1rrBXGOSD4f7fAuST9mij7YDXS/ DOXOkYebYvMv8ep7uXD9KCHPX6W/DHPkqR+J3qeZn75jKnKxZ+mth+GuvX/GkEkvHUPJ dLjw== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24347-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id w1-20020a17090abc0100b0028bbce449fcsi5228206pjr.86.2024.01.11.22.57.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 22:57:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24347-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24347-linux.lists.archive=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 267D7B2520F for ; Fri, 12 Jan 2024 06:55:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 97BE25C902; Fri, 12 Jan 2024 06:55:34 +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-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email haha only kidding 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 --- 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) -- 2.43.0