All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [wens:mtk-wip 24/48] drivers/gpu/drm/bridge/analogix/anx7625.c:2658 anx7625_typec_mux_set() error: 'port' dereferencing possible ERR_PTR()
Date: Sat, 18 Jan 2025 04:16:43 +0800	[thread overview]
Message-ID: <202501180409.LUg1bFSN-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: "Pin-yen Lin" <treapking@chromium.org>
CC: "Chen-Yu Tsai" <wenst@chromium.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/wens/linux.git mtk-wip
head:   a2f8143f6e1e6b3d8dac24f675646fbfdfc03202
commit: d62036e150e84eff425756d90cf8f060d86beb17 [24/48] drm/bridge: anx7625: Register Type C mode switches
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
config: arm-randconfig-r071-20250117 (https://download.01.org/0day-ci/archive/20250118/202501180409.LUg1bFSN-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 14.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202501180409.LUg1bFSN-lkp@intel.com/

smatch warnings:
drivers/gpu/drm/bridge/analogix/anx7625.c:2658 anx7625_typec_mux_set() error: 'port' dereferencing possible ERR_PTR()

vim +/port +2658 drivers/gpu/drm/bridge/analogix/anx7625.c

d62036e150e84e Pin-yen Lin 2023-03-31  2653  
d62036e150e84e Pin-yen Lin 2023-03-31  2654  static int anx7625_typec_mux_set(struct typec_mux_dev *mux,
d62036e150e84e Pin-yen Lin 2023-03-31  2655  				 struct typec_mux_state *state)
d62036e150e84e Pin-yen Lin 2023-03-31  2656  {
d62036e150e84e Pin-yen Lin 2023-03-31  2657  	struct drm_dp_typec_port_data *port = typec_mux_get_drvdata(mux);
d62036e150e84e Pin-yen Lin 2023-03-31 @2658  	struct anx7625_data *ctx = port->data;
d62036e150e84e Pin-yen Lin 2023-03-31  2659  	struct device *dev = ctx->dev;
d62036e150e84e Pin-yen Lin 2023-03-31  2660  	struct drm_dp_typec_switch_desc switch_desc = ctx->switch_desc;
d62036e150e84e Pin-yen Lin 2023-03-31  2661  	bool new_dp_connected, old_dp_connected;
d62036e150e84e Pin-yen Lin 2023-03-31  2662  
d62036e150e84e Pin-yen Lin 2023-03-31  2663  	if (switch_desc.num_typec_switches == 1)
d62036e150e84e Pin-yen Lin 2023-03-31  2664  		return 0;
d62036e150e84e Pin-yen Lin 2023-03-31  2665  
d62036e150e84e Pin-yen Lin 2023-03-31  2666  	/*
d62036e150e84e Pin-yen Lin 2023-03-31  2667  	 * The completion is called in anx7625_register_typec_switches
d62036e150e84e Pin-yen Lin 2023-03-31  2668  	 * even on errors, so it's safe to wait for completion without timeout.
d62036e150e84e Pin-yen Lin 2023-03-31  2669  	 */
d62036e150e84e Pin-yen Lin 2023-03-31  2670  	wait_for_completion(&ctx->mux_register);
d62036e150e84e Pin-yen Lin 2023-03-31  2671  
d62036e150e84e Pin-yen Lin 2023-03-31  2672  	/* Abort when the switches are unregistered. */
d62036e150e84e Pin-yen Lin 2023-03-31  2673  	if (!ctx->port_data)
d62036e150e84e Pin-yen Lin 2023-03-31  2674  		return -EINVAL;
d62036e150e84e Pin-yen Lin 2023-03-31  2675  
d62036e150e84e Pin-yen Lin 2023-03-31  2676  	old_dp_connected = ctx->port_data[0].dp_connected ||
d62036e150e84e Pin-yen Lin 2023-03-31  2677  			   ctx->port_data[1].dp_connected;
d62036e150e84e Pin-yen Lin 2023-03-31  2678  
d62036e150e84e Pin-yen Lin 2023-03-31  2679  	ctx->port_data[port->port_num].dp_connected =
d62036e150e84e Pin-yen Lin 2023-03-31  2680  		state->alt &&
d62036e150e84e Pin-yen Lin 2023-03-31  2681  		state->alt->svid == USB_TYPEC_DP_SID &&
d62036e150e84e Pin-yen Lin 2023-03-31  2682  		state->alt->mode == USB_TYPEC_DP_MODE;
d62036e150e84e Pin-yen Lin 2023-03-31  2683  
d62036e150e84e Pin-yen Lin 2023-03-31  2684  	dev_dbg(dev, "mux_set dp_connected: c0=%d, c1=%d\n",
d62036e150e84e Pin-yen Lin 2023-03-31  2685  		ctx->port_data[0].dp_connected, ctx->port_data[1].dp_connected);
d62036e150e84e Pin-yen Lin 2023-03-31  2686  
d62036e150e84e Pin-yen Lin 2023-03-31  2687  	new_dp_connected = ctx->port_data[0].dp_connected ||
d62036e150e84e Pin-yen Lin 2023-03-31  2688  			   ctx->port_data[1].dp_connected;
d62036e150e84e Pin-yen Lin 2023-03-31  2689  
d62036e150e84e Pin-yen Lin 2023-03-31  2690  	/* DP on, power on first */
d62036e150e84e Pin-yen Lin 2023-03-31  2691  	if (!old_dp_connected && new_dp_connected)
d62036e150e84e Pin-yen Lin 2023-03-31  2692  		pm_runtime_get_sync(dev);
d62036e150e84e Pin-yen Lin 2023-03-31  2693  
d62036e150e84e Pin-yen Lin 2023-03-31  2694  	anx7625_typec_two_ports_update(ctx);
d62036e150e84e Pin-yen Lin 2023-03-31  2695  
d62036e150e84e Pin-yen Lin 2023-03-31  2696  	/* DP off, power off last */
d62036e150e84e Pin-yen Lin 2023-03-31  2697  	if (old_dp_connected && !new_dp_connected)
d62036e150e84e Pin-yen Lin 2023-03-31  2698  		pm_runtime_put_sync(dev);
d62036e150e84e Pin-yen Lin 2023-03-31  2699  
d62036e150e84e Pin-yen Lin 2023-03-31  2700  	return 0;
d62036e150e84e Pin-yen Lin 2023-03-31  2701  }
d62036e150e84e Pin-yen Lin 2023-03-31  2702  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

             reply	other threads:[~2025-01-17 20:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-17 20:16 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-01-20  5:36 [wens:mtk-wip 24/48] drivers/gpu/drm/bridge/analogix/anx7625.c:2658 anx7625_typec_mux_set() error: 'port' dereferencing possible ERR_PTR() Dan Carpenter
2025-01-20  9:17 ` Pin-yen Lin
2025-01-20 10:17   ` Dan Carpenter

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=202501180409.LUg1bFSN-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.