From patchwork Wed Jun 5 19:54:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 2673471 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id BD9DE3FD4F for ; Wed, 5 Jun 2013 19:54:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757317Ab3FETyA (ORCPT ); Wed, 5 Jun 2013 15:54:00 -0400 Received: from mail-lb0-f171.google.com ([209.85.217.171]:35072 "EHLO mail-lb0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756549Ab3FETx7 (ORCPT ); Wed, 5 Jun 2013 15:53:59 -0400 Received: by mail-lb0-f171.google.com with SMTP id v5so2299946lbc.2 for ; Wed, 05 Jun 2013 12:53:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=to:subject:cc:from:organization:date:mime-version:content-type :content-transfer-encoding:message-id:x-gm-message-state; bh=iYI86MtYxBVF+Z7/hT5vv2tzFsF5Ay6V3f0xfBBHBAg=; b=edi5EpqhO2XQp/O6TWZwcqy0N/c3eUlinHQBzjANNm+7MJ8Bb2NqYTK7cirtUgoQpl aVFpuAYLx2230Z+3exd/a59IbD5oK+KKXkZlJiw0lFFhH3NfVv24oGQHE0ZgUM7R23Y/ HotFJ42mbB4hOXfCRWdTohmgGw9lez6o+fMmTit+Xpyt0Pac17Iet7hs1dYQpDa4xzIw qD4n4rlg/WPMwbVOtsPneeeFAogMLtyseID1HuMYswa8rByMwvC6LJpEsHq0/+PQJj28 uRnvtQEZT8cF8ulRq8v7uo6wMjvrRYtXpvAxy8iWzEkCXGOqKU8AOKTMP7DbugQWXhYY biJA== X-Received: by 10.112.150.42 with SMTP id uf10mr15828484lbb.89.1370462038201; Wed, 05 Jun 2013 12:53:58 -0700 (PDT) Received: from wasted.dev.rtsoft.ru (ppp91-76-88-205.pppoe.mtu-net.ru. [91.76.88.205]) by mx.google.com with ESMTPSA id i2sm6488020lah.5.2013.06.05.12.53.56 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 05 Jun 2013 12:53:57 -0700 (PDT) To: netdev@vger.kernel.org Subject: [PATCH] sh_eth: fix result of sh_eth_check_reset() on timeout Cc: nobuhiro.iwamatsu.yj@renesas.com, linux-sh@vger.kernel.org From: Sergei Shtylyov Organization: Cogent Embedded Date: Wed, 5 Jun 2013 23:54:01 +0400 MIME-Version: 1.0 Message-Id: <201306052354.02265.sergei.shtylyov@cogentembedded.com> X-Gm-Message-State: ALoCoQldoWDDWT0ZvUWwnW5pkJB+JedCXT/EUBx13R5od2TLKbU1ck30ubICQZ/Dnua+7MzDun5G Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org When the first loop in sh_eth_check_reset() runs to its end, 'cnt' is 0, so the following check for 'cnt < 0' fails to catch the timeout. Fix the condition in this check, so that the timeout is actually reported. While at it, fix the grammar in the failure message... Signed-off-by: Sergei Shtylyov --- The patch is against the David Miller's 'net.git' repo. Dave, since this is fixing the failure case, I don't think it's needed in -stable... drivers/net/ethernet/renesas/sh_eth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: net/drivers/net/ethernet/renesas/sh_eth.c =================================================================== --- net.orig/drivers/net/ethernet/renesas/sh_eth.c +++ net/drivers/net/ethernet/renesas/sh_eth.c @@ -897,8 +897,8 @@ static int sh_eth_check_reset(struct net mdelay(1); cnt--; } - if (cnt < 0) { - pr_err("Device reset fail\n"); + if (cnt <= 0) { + pr_err("Device reset failed\n"); ret = -ETIMEDOUT; } return ret;